Wednesday, November 17, 2010

Uptime command

# uptime

05:10PM up 6 days, 21:45, 13 users, load average 4.00, 3.00, 0.00

The uptime command prints the current time, the length of time the system has been up, the number of users online, and the load average. The load average is the number of runnable processes over the preceding 5, 10, or 15 minute intervals. The output of the uptime command is, essentially, the heading line provided by the w command.

#Who

Who command will give output from the recorded file /var/adm/utmp

# Last

Last command will give the output from the recorded file /var/adm/wtmp

The bootlist command

The bootlist command displays the list of boot device and alters the list of the boot device that is available in the servers.

To display the boot list in AIX 4L and 5L version:

bootlist –m normal –o

If you want to change the bootlist:

# bootlist –m normal hdisk0 hdisk1

In this above case the system will first boot from the hdisk0 and if it is not able to boot it will boot from the hdisk1

Identifying run level in AIX

# cat /etc/.init.state

2

The default runlevel in AIX is 2 and the default runlevel in Solaris in 3

System Initialization
Once the root file system has been mounted, the init command runs as the last step of the startup process it attempts to read the /etc/inittab file and it attempts to locate an initdefault entry in the /etc/inittab file.

If the initdefault entry exist, the init command user the specified run level as the initial system run level.
If the initdefault file does not exist, the init command places the system in the maintenance level by default.
The init command rereads the /etc/inittab file every 60 seconds; if the file has changed then the new commands in the /etc/inittab file are executed.

The /etc/inittab file

In the inittab file there are four fields separated by semi column
Identifier: Runlevel: Action: Command
Identifier -: A character that uniquely identifies an object
Runlevel -: Run level at which this entry can be processed Each process is started by the init command is assigned one or more run Levels
Run levels are represented by 0-9

Action -: Tells the init command how to treat the process specified in the process field There are some standard in the action field. They are:

Respwan: If the process does not exist, start the process do not wait for its
Termination – Continue scanning the /etc/inittab file and restarts the process when it dies.
Wait : When the init command enters the run level that matches the entry’s run level, start the process and wait for its termination.
Once : When the init command enters a run level that matches the entry’s run level, start the process and do not wait for termination. When it dies do not start the process.
Boot : During the system boot process the entry, which when the init command reads the /etc/inittab file during system startup, Start the process and do not wait for its termination and do not start when it dies.

Bootwait: Process the entry the first time that the init command goes from single- user to milti-user state after the system is booted. Same like boot.

powerfail : when server receives the power fail signal, execute the process.

Initdefauly: An entry with this action is only scanned when the init command is initially invoked.

Sysinit : Entries of this type are executed before the init command tries to access the console before login.


Command: A shell command to execute.
There are following command to change the inittab file
mkitab : adds records to the /etc/inittab file
lsitab : List records in the /etc/inittab file
chitab : Changes records in the /etc/inittab file
rmitab : Removes records from the /etc/inittab file.

Order of the /etc/inittab entries

The base process entries in the /etc/inittab file is ordered as follows:
1. initdefault
2. sysinit
3. Powerfailure Detection (powerfail)
4. Multiuser check (rc)
5. /etc/firstboot (fbcheck)
6. System Resource Controller (srcmstr)
7. Start TCP/IP daemons (rctcpip)
8. Start NFS daemons (rcnfs)
9. cron
10.pb cleanup (piobe)
11.getty for the console (cons)