[Klug-general] Cron job

Peter Childs peterachilds at gmail.com
Thu Apr 9 14:13:32 UTC 2009


2009/4/9 Nathan Friend <nathan.friend at gmail.com>:
> Afternoon All,
> I've writen a simple script to dump a database and would like it to run as a
> cron job.  How should I set the script permisisons?
>
> dbbackup.sh contains:
>
> NOW=$(date +"%d-%b-%y"_"%l:%M")
> FILENAME="moodle_db_backup_$NOW.sql"
> mysqldump -uuser -ppassword databasename > /dbbck/$FILENAME
>
> The cron entry is
>
> 30 20 * * * /usr/local/script/dbbackup.sh
>
> I can run the script from for command line OK with the expected output.
> However wathcing /var/log/messages I see the cron job run but no output
> file...
>
> Cheers,
>

 looks fine to me, I would add some debug, anything you echo should
get emailed to you once its completed. Is it still running (Check with
ps). Oh and the #!/bin/bash line is needed.

Peter.



More information about the Kent mailing list