mercredi 7 janvier 2015

Why does my cronjob not execute my shell-script?


I have a crontab that creates a dump of my database every night:



20 3 * * * /path/to/dailydump.sh


dailydump.sh contains:



#!/bin/sh

DATENAME=`date +%Y%m%d`

BASENAME="/path/to/dumps/db_${DATENAME}.sql"

/usr/bin/mysqldump -hhost -uusername -ppassword databasename > ${BASENAME}


Permissions are:



-rwx---r-x 1 ... dailydump.sh
drwxr-xrwx 2 ... dumps


Why does my cronjob not work?


I'm on a shared server without root access. There are no logs in /var/log/cron or /var/log/syslog. There is not mail in /var/mail/<user_name> or /var/spool/mail/<user_name> (in fact there is nothing at all in /var/mail/ and /var/spool/), MAILTO=my@email.com does not mail any error messages, and 1 2 * * * /path/to/your/command &>/path/to/mycommand.log does not save any log file. ps -ef | grep cron | grep -v grep? returns nothing.


The whole setup worked fine until I moved all files to a new domain and had to setup a new crontab. (Yes, I updated all paths and the database login information. I checked it multiple times, too.)


Any help would be greatly appreciated.



Aucun commentaire:

Enregistrer un commentaire