[Linux-disciples] write to file from shell script

Adam Rosi-Kessel adam at rosi-kessel.org
Tue Nov 15 22:56:34 EST 2011


On 11/15/2011 10:42 PM, Jamie Forrest wrote:
> 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...)
> _______________________________________________
> Linux-disciples mailing list
> Linux-disciples at lists.bostoncoop.net
> http://lists.bostoncoop.net/mailman/listinfo/linux-disciples
>
Add a cd /path/to/somewhere at the beginning.

Also, this looks like OS X. I cannot confirm that anything should ever 
work on OS X.


More information about the Linux-disciples mailing list