Hp-UX overview.doc

14
HP-UX Overview and Command Summary Bootup/Shutdown shutdown -r 0 --> reboot shutdown -h now --> shutdown and halt shutdown 0 --> shutdown to single user mode reboot 0 --> reboot init 1 - single user mode hpux -is boots single user mode Interupting the boot process: Configuration Menu Information Menu Service Menu GSP Mode From the console hit <ctrl><b> Hit <Enter> at the GSP console login (default is no password)  Now low level commands can be entered o  ps --> power status To reboot to single user mode: 1. shu td own -r 0 2. hit <space > dur ing 10 sec window to interrupt r eboot 3. ente r: <b><o> 4. inte ra ct wi th ipl? yes 5. hpux -is (i =init, s=s ingle use r) To reboot manually to init 3 level 1. shu td own -r 0 2. <space> dur ing 10 s ec window 3. bo 4. inte ra ct wi th ipl --> yes 5. hpux -is (i=init, s=single use r mode) 6. mount -a 7. init 3 Startup/Shutdown Scripts /sbin/init.d /sbin/rc0.d These are all linked to actual scripts in /sbin/init.d /sbin/rc1.d /sbin/rc2.d scripts with k are kill scripts and scripts with s are start scritps.

Transcript of Hp-UX overview.doc

Page 1: Hp-UX overview.doc

7/30/2019 Hp-UX overview.doc

http://slidepdf.com/reader/full/hp-ux-overviewdoc 1/14

HP-UX Overview and Command Summary

Bootup/Shutdown

shutdown -r 0 --> reboot

shutdown -h now --> shutdown and haltshutdown 0 --> shutdown to single user modereboot 0 --> rebootinit 1 - single user modehpux -is boots single user mode

Interupting the boot process:

• Configuration Menu

• Information Menu

• Service Menu

GSP Mode• From the console hit <ctrl><b>

• Hit <Enter> at the GSP console login (default is no password)

•  Now low level commands can be entered

o  ps --> power status

To reboot to single user mode:

1. shutdown -r 02. hit <space> during 10 sec window to interrupt reboot3. enter: <b><o>

4. interact with ipl? yes5. hpux -is (i=init, s=single user)

To reboot manually to init 3 level

1. shutdown -r 02. <space> during 10 sec window3. bo4. interact with ipl --> yes5. hpux -is (i=init, s=single user mode)6. mount -a

7. init 3

Startup/Shutdown Scripts

/sbin/init.d/sbin/rc0.d These are all linked to actual scripts in /sbin/init.d/sbin/rc1.d/sbin/rc2.d scripts with k are kill scripts and scripts with s are start scritps.

Page 2: Hp-UX overview.doc

7/30/2019 Hp-UX overview.doc

http://slidepdf.com/reader/full/hp-ux-overviewdoc 2/14

/sbin/rc3.d/sbin/rc4.d

/etc/rc.config.d --> Scripts

CIFS (Samba)

/opt/etc/samba/smb.conf 

Device Management

HP-UX is a hardware path based operating system. When it boots up it does a hardwaredetection. It then compares the hardware that it detects with the hardware that is listed in/etc/ioconfig. If new hardware is detected, it is assigned the next available configurationinformation in the proper hardware path.

rmsf - remove special filesinsf - install special files

insf -C disk -e <-- This command will re-install all of the device files for the class "disk"

lsdev <-- Lists devices and drivers in the system

ioscan <-- searches for all devices and displays their hardware pathioscan -fnC disk <-- searches for all devices of class (C) disk ioscan -fnH <LUN> <-- searches for a LUN

last 2 digits of hardware path in the LUN in octal (1/12/0/0.1.23)

Disk Devices

A disk device will have a name in the following format: c#t#d#

c# is the card number t# is the target number d# is the LUN - this is normally 0 unless RAID is being utilized

scsictl -a /dev/rdsk/c?t?d? <-- display control parameter information about the disk devicescsictl -a -m queue_depth=4 -m queue_depth /dev/rdsk/c?t?d? <-- sets the queue depth

CD-ROM Devices

nohup /usr/sbin/pfs_mountd & - starts processnohup /usr/sbin/pfds & - starts process

Page 3: Hp-UX overview.doc

7/30/2019 Hp-UX overview.doc

http://slidepdf.com/reader/full/hp-ux-overviewdoc 3/14

 pfs_mount -o xlat=unix /dev/dsk/c0t1d0 /cdrom - mounts cdrom

Cdrom won't eject:

1. pfs_umount -c OR  2. kill -9 pfs_mountd and kill -9 mountd

Cdrom won't mount using: pfs_mount -o xlat=unix /dev/dsk/c0t1d0 /cdrom

1. nohup /usr/sbin/pfs_mountd &2. nohup /usr/sbin/pfsd3. /usr/sbin/pfs_mount /cdrom <-- this uses mounting information in /etc/pfs_fstab

7400 Disk Array

armdsp -a va7400 <-- real time display of the disk arrayarmmgr -D va7400 HPA6189A00SG218H0024armdiscover /opt/sanmgr/commandview/client/sbin --> Tells us the serial number 

armhost -d <Array Worldwide Name> <Serial #>armhost -d 50060b000014e313 00SG218J0024ioscan -fnc disk | more

cvui - creates luns

• Choose storage array

• Create LUN

o Find last LUN

o Create with new lun number 

• View existing luns

Process to export disk configuration to a file:• sam --> actions-->export

• volume group name --> mapfile name

Fibre Channel Devices

ioscan -fknC fc <-- Lists fibre channel adapters.

To identify the devices:

ls -l /dev/fc*

fcmsutil - utility for fibre channel operationsfcmsutil /dev/<device>

Procedure to run fcmsutil on a fibre channel:

ioscan -fnC disk|more --> Identify hw path of fibre channel adapter ioscan -fnH 1/0/0/0 --> Identify device of fibre channel adapter or ls /dev/fc* on older adapters (arbitrated loop)

Page 4: Hp-UX overview.doc

7/30/2019 Hp-UX overview.doc

http://slidepdf.com/reader/full/hp-ux-overviewdoc 4/14

fcmsutil /dev/fcms2 stat --> fcmsutil that shows status of fibre channel adapter 

Logs

/etc/rc.log Startup Log

/var/adm/sw/swagent.log Software package installation log

/var/adm/syslog/syslog.log System Error Log

/etc/shutdownlog Shutdown Log

/var/tombstones/ts99 Crash log

Login Environment

/etc/profile - main profile for all users

/etc/profile.env

export TMPDIR=/tmpsortexport TEMPDIR=/tmpsort

source a profile: ". ./profile"

Changing prompt:

export PS1=$(hostname):'$PWD # '

This gives a prompt that has the hostname followed by the current directory, ending in the #(useful for root logins).

Networking

netstat -a <--portsnetstat -i <--interfacesnetstat -r <--routing tablenetstat -rv <--routing table and subnet mask 

lanscan - provides hardware information about the nics in the server lanadmin - menu driven interface to administer lan nicslanadmin -x 0 bypass menu and show lan driver specific options for nic with id 0lanadmin -X 100FD 0 - bypass menu and set nic at id 0 to 100 MBS, Full Duplex

ioscan -fnkC lan - shows ioscan information for device type "lan"

Page 5: Hp-UX overview.doc

7/30/2019 Hp-UX overview.doc

http://slidepdf.com/reader/full/hp-ux-overviewdoc 5/14

lanscan -i|awk '{print $1}'|xargs -i ifconfig {} -> does an ifconfig on all defined interfaces onthat server 

Changing the IP Address and Subnet mask:

• set_parms ip_address

Then supply ip address and subnet mask when prompted. This process will require areboot.

Changing the Default Gateway

• cd rc.config.d

• vi netconf 

Network Time Protocol (NTP)

ntpq -p --> lists ntp peers and their time sync statusntpq -p <server fqdn or ip address> --> lists time sync status with that server (slightly different

detail than ntpq -p)

/etc/ntp.conf --> configuration fileChanges to the configuration require ntp daemon (xntpd) be stopped and restarted (restart is notrecognized):

• /sbin/init.d/xntpd stop

• /sbin/init.d/xntpd start

Printing

Command Description

cancel deletes print jobs from queue

hppi jet admin

ls -d<destination>-o<optioni> file

 prints a file

lpadmin

lpsched -v

lpstat lists jobs in queue. -s -t

 pr .profile | lp -n3 prints

 pr -o10 -l64 -F -h<HEADER> <file> | lp

 prints using margins of 10, page length of 64, header on each page

/etc/lp

Page 6: Hp-UX overview.doc

7/30/2019 Hp-UX overview.doc

http://slidepdf.com/reader/full/hp-ux-overviewdoc 6/14

/usr/lib/lp/var/adm/lp/var/spool/lp

/etc/lp/interface - interface scripts

/var/sam/lp/lpinfo

Migrating the printer configuration from one server to another server using SAM:

On the source server:• SAM --> Printers & Plotters --> LP Spooler --> Save/Restore Spooler Configuration

• Actions --> Save Spooler Configuration

o This saves the information in the directory /var/sam/lp

• Save this directory using tar: "tar -cvf /tmp/lp.tar /var/sam/lp"

• Copy this tar file to the destination server 

On the destination server:• Extract this file: "tar -xvf lp.tar"

• SAM --> Printers & Plotters --> LP Spooler --> Save/Restor Spooler Configuration

• Actions --> Restore Spooler Configuration

Performance Monitoring

top

j moves forward pages in the displayk moves backwared pages in the display

glance (if installed)

sar -qsar -usar -d

vmstat

vminfo

Process Management

Command Description

inetd -c Causes inet to reload /etc/inetd.conf  

Page 7: Hp-UX overview.doc

7/30/2019 Hp-UX overview.doc

http://slidepdf.com/reader/full/hp-ux-overviewdoc 7/14

inetd -l starts logging in /var/adm/syslog/syslog.log

 ps -ef | grep PROD list all processes, but only show those processes that have "PROD"in them

/sbin/init.d/<script> [start|

stop]

If the script exists, this will stop and start the associated processes.

/etc/services --> Lists the services and their configuration/etc/inetd.conf --> Lists the services and their configuration/var/adm/inetd.sec --> This file contains security information on who may request a particular  process

Remote Access

rcp <source> remote_machine:<path>

remsh <host>

rlogin <host>

.rhosts file needs to be configured or else you will be prompted for username and password(located in home directory)

last -R - gives address information of last remote login, useful for troubleshooting

Software Installation and Management

To install patches and software use:

swinstall --> This will lauch the gui or swinstall -x <option> -x <option> -s <path to depot> --> This will still lauch the gui, but the parameters will be preselected. This is use to allow selection of additional parameters that maynot be selectable from the gui itself (such as the logging levels below)

For example some popular options are:• -x mount_all_filesystems=false

• -x logdetail=true

• -x loglevel=2

 Note:• To install a depot you must specify the complete path to the depot and the depot name.

• To install patches you must specify the complete path to the directory that has the patch

files.

Page 8: Hp-UX overview.doc

7/30/2019 Hp-UX overview.doc

http://slidepdf.com/reader/full/hp-ux-overviewdoc 8/14

Location of logfiles:

/var/adm/sw/swagent.log/var/adm/sw/swinstall.log

Listing all Software

swlist -l product | more

Checking for Specific Software

swlist -l product | grep <SEARCH STRING>

Checking for Specific Patches

swlist -l product| grep PH | more

then search for a specific patch (ie PHNE_XXXXX)

Manually applying patches

Patches can be applied using swinstall, just as depots are installed• swlist -l patch -a patch_state PHKL_25475

swcopy -s /tmp/*.depot -\*@/var/spool/sw

Cleaning up after applying patches:

cleanupcleanup -c n <-- commits patches that have been superseded n number of times. Useful to freeup disk space in /var/adm/sw/save.cleanup -p <-- previews the actual cleanup tasks but does not actually perform the cleanup

check_patchesshow_patches

Creating a single patch depot out of multiple individual depots:

From the directory that has all of the individual depots run this command line script:for i in PH*.depotdo

swcopy -x enforce_dependencies=false -s ${PWD}/$i \* @ /tmp/patch_depot <--/tmp/patch_depot is the destination directorydone

System Information

Page 9: Hp-UX overview.doc

7/30/2019 Hp-UX overview.doc

http://slidepdf.com/reader/full/hp-ux-overviewdoc 9/14

 Note: See section on STM, detailed system information is available with this utilityAlso SAM -->Performance Monitors --> System Properties

OS Information

uname -a - display general information e.g. OS release, node name, machine ID number, etc

 print $(uname -i)16op|dc hex system id/opt/itor/bin/i4target -v spu

file /stand/vmunix <-- shows whether 64 bit or 32 bit kernelgetconf KERNEL_BITS <--shows whether 64 bit or 32 bit kernel

Memory Information

dmesg|grep Phy <-- List amount of physical ram in server cat syslog|grep Phy <-- List amount of physical ram in server echo phys_mem_pages/D|adb -k /stand/vmunix /dev/kmem <-- Lists amount of 4K Memory pages in HPUX 11.xecho "memory_installed_in_machine/D" | adb -k /stand/vmunix /dev/mem |tail -1 | awk '$2 > 0{ print $2 / 256 }' <-- Lists memory in MB.echo "physmem/D" | adb /stand/vmunix /dev/kmem <-- Lists amount of 4K Memory pages inHPUX 10.x

model <-- information about the model of the workstation/server 

sam --> Performance Monitors --> System Properties --> Memory Tab

CPU Information

ioscan -fnC processor <-- shows information about each processor found

echo "itick_per_usec/D" | adb -k /stand/vmunix /dev/mem | tail -1 <-- Shows CPU Speed inMHZ

sam --> Performance Monitors --> System Properties -->Processor Tab

echo itick_per_tick/D | adb /stand/vmunix /dev/kmem - gives processor speed 

 grep model /usr/lib/sched.models - gives type of processor for 10.X systems

 grep model /opt/langtools/lib/sched.models - gives processor type for 11.X systems

Changing the Server Name and the IP Address

• Using set_parms --> may not work correctly for multiple nics

o set_parms hostname ( a reboot is required for the change to take effect)

Page 10: Hp-UX overview.doc

7/30/2019 Hp-UX overview.doc

http://slidepdf.com/reader/full/hp-ux-overviewdoc 10/14

It will prompt you for the new hostname It will prompt you to reboot (answer no if you are also changing the ip

address)o set_parms ip_address ( a reboot is required for the change to take effect)

It will prompt you for the new ip address

It will prompt you to reboot• Manually makiing the change:

o vi /etc/hosts

o vi /etc/rc.config.d/netconf <-- ** Make sure that no extra files are in the

/etc/rc.config.d directory - it gets sourced on bootupo reboot

• Other files that may need to checked/changed

o /etc/resolv.conf 

o /etc/nsswitch.conf 

System Tuning

Extract Current System File

• cd /stand/build

• /usr/lbin/sysadm/system_prep -s /stand/build/system

o file is called system

o section called "Tunable Parameters"

kmtune - displays the tunable parameters

kmtune -l <-- This displays a detailed report of the parameters (current, planned, default,minimum, etc)sam allows you to tune the kernelManual Kernel Build (not using sam) --> /usr/sbin/mk_kernel -s /stand /build/system

STM

diaglogd

/var/opt/resmon/log

Procedure to use STM to determine memory configuration• Type stm at the command line

• Type o to select ok 

• Press the down arrow in the displayed map and select memory by hitting the space bar 

• Press tab to go to menus and arrow over to Tools and hit enter 

• Select Information -> and hit enter 

• Select Information Log and hit enter 

• Information Tool Log for Memory will be displayed

Page 11: Hp-UX overview.doc

7/30/2019 Hp-UX overview.doc

http://slidepdf.com/reader/full/hp-ux-overviewdoc 11/14

• To print either select Print or SaveAs (to save the log to file for later printing)

Command Script to print useful information to a file called info

echo "sel path system; info; wait; infolog

>view>done>"lcstm>info#cat info

 print_manifest (located in /var/opt/ignite/local/manifest/manifestinfo ??)

Command Script to print useful information

cstmcstm>Mapcstm>SelAll

cstm>Informationcstm>Infologcstm>exit

Command Script to print useful information (not sure this is complete/correct)cstmcstm>SelClass type "Disk" qualifier "All"cstm>info;waitcstm>ilcstm>create /tmp/disk.stmcstm>donecstm>quitcstm>ok 

cstm -f /tmp/disk.stm

Terminal Environment

TERM - environmental variable indicating type of terminalsttytermio

/usr/share/lib/terminfo

setup string for xterm: /usr/bin/X11 -ls -d @D

$DISPLAY=192.168.70.80:0.0

$TERM = xterm

Page 12: Hp-UX overview.doc

7/30/2019 Hp-UX overview.doc

http://slidepdf.com/reader/full/hp-ux-overviewdoc 12/14

sttystty -all

Running Exceed --> xstart• <ctrl> Rightl Click --> Huge

Starting an X-Window application from telnet

start an X-Window server on the PC, such as exceedexport DISPLAY=W.X.Y.Z:0.0 <---W.X.Y.Z is the IP Address of the PC/opt/ignite/bin/ignite <---Now just run the program

Configuring an HP 700/96 Terminal for a server connection:

• Terminal Ports

o Port 1

Datacommunications 25 Pin - use this to connect to the N class server with a 25 pin to 9 pin

cableo Port 2 - used to connect to an external peripheral

Parallel 25 Pin

o Port 3

Datacommunications 9 Pin - use this port to connect to the A class server with a 9 pin to 25 pin

cable• Terminal Configuration Settings

o

Press User/System function key modes

Remote Mode must have an asterisk in it's box (indicating it isselected)

config keys datacomm config

 baud rate 9600  parity: none/8 xon/xoff 

terminal config serial (2)/parallel(1) - 25 pin console port

serial (1)/parallel(1) - 9 pin console port Term ID - vt100 Term Mode - em100

ansi config em100  backspace/del

Page 13: Hp-UX overview.doc

7/30/2019 Hp-UX overview.doc

http://slidepdf.com/reader/full/hp-ux-overviewdoc 13/14

Users Administration

Creating Users

• sam --> user and group accounts

• useradd -g users -d <homedirectory> Username

Creating Groups

sam --> user and group accountsgroupadd Groupname

Useful Commands

Command Description

<esc><esc> or <esc>\ autocompletion

file * Show file types, such as "ascii".

find <path> -name <name>-print

Finds a file in the OS at the starting path on down

grep

groups <username> Shows groups for a user  

kmtune Displays kernel tunable parameters

listusers -g <group> Lists the users in a group

ln -s <file or directory><symbolic link>

Creates a symbolic link to a file or a directory

 pr -o10 -l64 -F -h<HEADER> <file> | lp

 prints using margins of 10, page length of 64, header on each page

rcp <source>remote_machine:<path>

remote copy

remsh <host> opens a remote command shell on the host machine

rlogin <host> remote login to host machine

sar 

set_parms Change host name (/etc/set_parms)

tail -f <file> Looks at end of file and keeps it open to watch changestop realtime display of processes

uname -a information about the system

 print $(uname -i)16op|dc prints hex system id

who -u, who -Rm who is using the system

Page 14: Hp-UX overview.doc

7/30/2019 Hp-UX overview.doc

http://slidepdf.com/reader/full/hp-ux-overviewdoc 14/14

Process to recover from a lost/forgotten root password

1. Power off the server 2. Power on the server 3. Interupt the boot process during the 10 second interval (display will indicate this on the

screen)4. bo pri

5. Answer  yes to interact with the ipl6. At the prompt "hpux -is" for single user mode7. cd /sbin

8. passwd root and follow prompts to put in new password9. shutdown -r 0 to reboot to multiuser mode

Oracle Procedures:

I have a need to remove some semaphores and a memory segment from a sun box to clean up afailed Oracle instance. The server has several Oracle Instances and allocated memory segmentsand I need to identify the proper one to 'ipcrm -m' on.....Does anyone know how I get more detailas to the owner of the segments?

Thanks,

Thomas

Unfortunately I was using that syntax to begin with and only gets me limited data, however by

ipcs -pmb and ipcs -sa I was able to identify all oracle semaphore id's and memory segment id's.Then by connecting to the surviving instances, doing a dump of that instance memory andsemaphore maps, I was able to determine which id's not to remove from memory, thus enablingme to clean up the failing instance memory.

Thanks,Thomas