#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2013
    Posts
    4
    Rep Power
    0

    How to get the system logs while executing a command


    Hello,
    How to get the system logs while exectuing a command:

    Example:
    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.?

    any idea?

    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.
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2013
    Location
    Oklahoma
    Posts
    11
    Rep Power
    0
    [quote]2>&1[quote]

    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.

IMN logo majestic logo threadwatch logo seochat tools logo