[Linux-disciples] write to file from shell script

Stephen R Laniel steve at stevereads.com
Tue Nov 15 22:58:54 EST 2011


GNU v. BSD leads to some oddities, but this looks like straight bash or straight POSIX. 

-- 
Stephen R. Laniel
steve at stevereads.com
Cell: +1 617 308 5571
http://stevereads.com/
PGP key: http://stevereads.com/slaniel.key

On Nov 15, 2011, at 10:56 PM, Adam Rosi-Kessel <adam at rosi-kessel.org> wrote:

> 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.
> _______________________________________________
> Linux-disciples mailing list
> Linux-disciples at lists.bostoncoop.net
> http://lists.bostoncoop.net/mailman/listinfo/linux-disciples
> 


More information about the Linux-disciples mailing list