September 30th, 2013, 09:52 AM
How to get the system logs while executing a command
How to get the system logs while exectuing a command:
command : /usr/local/bin/krsh <servername> w | head -2
gives an output like this:
[B]trying normal rsh (/bin/rsh)[/B]
09:50:05 up 69 days, 16:40, 14 users, load average: 0.46, 1.13, 0.93
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
The highlighted line is a system log, the actual output starts from 09:50. To capture the system log (highlighted) what should be done.?
As of now: i use this line in my script:
$output = `/usr/local/bin/krsh asifdl01devv w | head -2 2>&1`
this is not providing me the system logs.
October 25th, 2013, 09:40 PM
All that is doing is redirect STDOUT and STD ERR. That won't redirect the log information in the script your running. You have to get your script to also print to STDOUT.