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.
Put the following text in a file called swconsole in /usr/bin.
#!/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 swconsoleThe syntax for using this script is as follows:
swconsole /name/of/file /name/of/tty
For example:
swconsole /tmp/rc.out /dev/consoleModify the entry in /etc/inittab of each script or program you wish to monitor.
For example, modify the following entry:
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.)
[ Doc Ref: 90605199514600 Publish Date: Spt. 07, 1999 4FAX Ref: 8244 ]