Log in

No account? Create an account

February 7th, 2007 - Open Knowledge — LiveJournal

Feb. 7th, 2007

06:10 am - Bone Lovers

Bone Lovers, originally uploaded by crasch.

Via ivorjawa via yahoo.

02:19 pm - GEEK: crontab weirdness?

Okay, so I have this crontab:

DATE=`date +%Y-%m-%d_%H%M`

# Nightly Processes
*      *      *       *       *     $MROOT/test.py >& $MROOT/log/testlog.$DATE

It's supposed to log the ouptut of test.py to $MROOT/log/testlog.$DATE every minute. However, although it creates the log file, the file is empty:

sh-2.05b# ls -al testlog*
-rw-r--r--   1 build  build  0 Feb  7 14:18 testlog.2007-02-07_1418

Now, I know that test.py is creating output--if I run it from the command line, I can see the output. And that output appears to be coming from stderr--if I run ./test.py > testlog.out, nothing is logged, but if run ./test.py 2> testlog.out, the output is logged.

I also know the ">&" redirect is C-shell syntax. So I tried it with Bourne shell syntax:

* * * * * $MROOT/test.py > $MROOT/log/testlog.$DATE 2>&1

This time, the output file was created (still empty). But now the logfile name instead of being set to this:


was set to this:

testlog.`date +%Y-%m-%d_%H%M`

Anyone know:

1) Why changing the redirect would cause the $DATE variable to be substituted with the string literal rather than the output of the date command?

2) Why stderr isn't being logged to the log file?

(I'm running on 10.4.8 Tiger Server).

Previous day (Calendar) Next day