[Klug-general] Cron job

Fish goldfish654 at gmail.com
Thu Apr 9 14:07:25 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...
>

You probably need a shebang at the top of the file so it knows what
shell to use:

#!/bin/bash



More information about the Kent mailing list