This script captures the output from programs and scripts
started in the /etc/inittab and sends this output to a file
and to the console (or whichever tty you specify). It has
been tested on AIX Version 3.2.5.1.
Users of AIX Version 4 should use the alog command.
http://www.rs6000.ibm.com/resource/
Put the following text in a file called swconsole in /usr/bin.
For example:
For example, modify the following entry:
Related Documentation
The AIX and RS/6000 product documentation library is also available:
Procedure
WARNING: Before using the script in this document on a
production system, test it
first. Since this script becomes part of the startup
process, you MUST have tested alternate boot media available
in case of a problem.
#!/usr/bin/ksh
# swconsole
/usr/bin/awk -v FILE="$1" -v OUTPUT="$2" '
{
output_file=sprintf("%s",FILE)
screen_output=sprintf("%s",OUTPUT)
printf("%s\n",$0) >>output_file
printf("%s\n",$0) >>screen_output
}' >/dev/null
# End of /usr/bin/swconsole.
Make the file executable and owned by user and group "bin":
# cd /usr/bin
# chmod 755 swconsole
# chown bin:bin swconsole
The syntax for using this script is as follows:
swconsole /tmp/rc.out /dev/console
Modify the entry in /etc/inittab of each script or program
you wish to monitor.
rc:2:wait:/etc/rc > /dev/console 2>&1
# Multi-User checks.
Change it to:
rc:2:wait:/etc/rc 2>&1 | swconsole /tmp/rc.out /dev/console
# Multi-User checks.
In the preceding example, the initialization messages from /etc/rc
will be written to both the console and to /tmp/rc.out. (The
file /tmp/rc.out can be any writable file of your choice.)
Dated: 98/09/08~00:00 Category: cmd
This HTML file was generated 99/06/24~12:41:56
Comments or suggestions?
Contact us