Quantcast
Channel: UNIX and Linux Forums
Viewing all articles
Browse latest Browse all 16232

Who -u gives different output if run from cron than if run from terminal?

$
0
0
If I run 'who -u' interactively or from a script invoked through bash in a tty on my Ubuntu 12LTS box I get an output like this:
testuser pts/0 Dec 9 02:32 . 2163 (host.xx.yy)

running the same through cron I get:
testuser pts/0 2012-12-09 02:32 00:05 2163 (host.xx.yy)

I want to check for idle ttys and thus tried to look at field 6 but my script fails because if run through cron I get the PID instead of the idle time.

I can not find anything about output format in the man page of who.
On the info coreutils 'who invocation' I find that the TZ variable affects the output but TZ is not set in my shell nor in the cron environment.
(BTW. I don't like the info pages because I cannot filter them properly)

Is there an easy way to get a standardized output from who?

Viewing all articles
Browse latest Browse all 16232

Trending Articles