[RndTbl] stderr/stdout in Linux cronjobs?

Grigory Shamov Grigory.Shamov at umanitoba.ca
Fri Jan 23 09:47:37 CST 2015


Hi All,

I have a weird (or stupid idk) problem. A script of mine produces
different results when ran interactively as root, from when ran as a cron
job.

used=`report -i --csv 2>/dev/null | awk '/Total/ {print $4}'`
echo $used is Total
 

The command executed says "Using config file XXX" to stderr and something
useful to stdout of which I extract the value of  Total. Redirecting the
barf to /dev/null. 

Now as a cron job the $used is empty. I believe that cronjob would
redirect stderr to stodut? But here it happens also for the subprocesses ?
Confused..

-- 
Grigory Shamov

Westgrid/ComputeCanada Site Lead
University of Manitoba
E2-588 EITC Building,
(204) 474-9625






More information about the Roundtable mailing list