[Linux-disciples] write to file from shell script

Adam Rosi-Kessel adam at rosi-kessel.org
Wed Nov 16 07:13:59 EST 2011


Best practice is *always* specify full
path for cron jobs, even where it would otherwise be in the path. This avoids the possibility that some executable with the same name could jump in ahead of what you want to run in the path at a later date (eg, /usr/local/bin vs /usr/bin).

Sent from mobile

On Nov 15, 2011, at 11:46 PM, Jamie Forrest <jamie at jamieforrest.com> wrote:

>> #!/bin/bash
>> 
>> dumpfile=`date +%F-%H%M%S`_dump.sql
>> cd /Users/jforrest/Projects/django-cnsltme/cnsltme/
>> gondor sqldump primary > /tmp/$dumpfile
>> cd /tmp
>> tar -czf $dumpfile.tar.gz $dumpfile
>> mv $dumpfile.tar.gz /Users/jforrest/Dropbox/Pirate/db_backup/
>> rm $dumpfile
> 
> The issue here was that gondor was not in the path that cron was
> looking at. Calling the full path with gondor made the script work
> from cron.
> 
> Jamie
> _______________________________________________
> 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