I scheduled a task every 5 minutes in my crontab.

The task is well-scheduled by activating the cron log in rsyslog and checked that it executes as planned:

- Right user
- Right command

Sample log entries:

Dec 23 06:40:01 computer /USR/SBIN/CRON[26422]: (myuser) CMD (bash /home/myuser/save.sh &>/home/myuser/cron.log)

I even tried:

Dec 23 06:40:01 computer /USR/SBIN/CRON[26422]: (myuser) CMD (/home/myuser/save.sh &>/home/myuser/cron.log)

Sample crontab command:

*/5 * * * * /home/myuser/save.sh &>/home/myuser/cron.log

The script has the right rights: it can be executed by myuser

Sample script:



if [ ! -d "$PERMANENT" ]; then
    mkdir "$PERMANENT"

echo `date +%x\ %X`>$HOME_DIR/$LOGFILE
# Check if both directories actually exist
if [ -d "$VOLATILE" -a -d "$PERMANENT" ]; then
    # Control will enter here if both $VOLATILE and $PERMANENT exist.
    rsync -r -t -v "$VOLATILE" "$PERMANENT">$LOGFILE.output
    if [ ! -d "$VOLATILE" ]; then
        echo "Volatile dir does not exist">>$HOME_DIR/$LOGFILE
    if [ ! -d "$PERMANENT" ]; then
        echo "Permanent dir does not exist">>$HOME_DIR/$LOGFILE

The command is a bash script which executes properly manually with the same user (even if I copy-paste the exact command executed in cron), but does nothing automatically.

I redirect the script's output in a custom log file to check its execution, which remains empty when the automatic execution happens.

I am totally lost, I dunno what's wrong.

What am I forgetting?

[EDIT] I am using Debian 6 Squeeze

  • Show us the cron entry. Which OS are you using ? – user9517 Dec 25 '12 at 6:59
  • Debian Squeeze, I just edited my post – Bernard Rosset Dec 25 '12 at 7:01
  • They're log entries not your cron jobs (from crontab). – user9517 Dec 25 '12 at 7:06
  • We need to see your crontab entry, and if it calls a script, the script itself as well. – Lipongo Dec 26 '12 at 4:00
  • Cron job + shell script added – Bernard Rosset Dec 27 '12 at 13:27

Are you missing a newline on the end of the job, in your crontab?

What does "crontab -l" show?

| improve this answer | |
  • I edited my crontab and added a new line after my task. Now with crontab -l a new line appears before the prompt. Task still doesn't do its job – Bernard Rosset Dec 27 '12 at 14:18

I had the same problem, and i fixed it by removing the "." from the file name. In your case should be:

*/5 * * * * /home/myuser/save &>/home/myuser/cron.log
| improve this answer | |
  • You removed more than just the "." from that line... – Chris S Mar 26 '13 at 12:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.