[Linux-disciples] write to file from shell script

Jamie Forrest jamie at jamieforrest.com
Tue Nov 15 22:42:33 EST 2011


Okay here's another oddity:

The script works fine when I run it from the cmd line. But when I call
it from crontab, the file it creates is empty. Here's the script,
followed by the crontab.

#!/bin/bash

dumpfile=`date +%F`_dump.sql
gondor sqldump primary > $dumpfile
tar -czf $dumpfile.tar.gz $dumpfile
mv $dumpfile.tar.gz /Users/jforrest/Dropbox/Pirate/db_backup/
rm $dumpfile

#############

* * * * * /Users/jforrest/Projects/django-cnsltme/cnsltme/backup/fetch_db_dump.sh

(Don't worry, I won't run this every minute once I confirm it's working...)


More information about the Linux-disciples mailing list