I have created a cron job that runs a script which moves files from one location to another.
Here is my result after running crontab -l

0 6 * * 0 root /root/scripts/move.script.sh

move.script.sh has following lines of codes:

/bin/rm -rf /home/user1/folder2/Monday/*
/bin/mv /home/user1/folder1/* /home/user1/folder2/Monday/

With this code, I first remove the stuff from last week in Monday folder and then copy stuff from user1's folder1.

How ever this job doesn't run at all.

I have checked with other cronjobs but they work fine and the problem is with this cronjob only.

Can anyone tell me what I have done wrong in here?


The format of cron entries in /etc/crontab and cron daemon, located in /var/spool/cron/$username are different. In /etc/crontab, you have to specify the user-name under which the command will be executed, while in the later you don't have to.

The crontab -l command you executed shows you the cron entries for the user executing that command. It doesn't show you the /etc/crontab entries. In short, you have to remove the user root from the cron entry.

Edit the cron entry using the command

  crontab -e

Then replace your entry with the one below

  0 6 * * 0 /root/scripts/move.script.sh
  • 1
    Also the shell script most have executable and read permission for root user. – Mircea Vutcovici Jan 30 '13 at 4:07
  • Thanks Daniel I'll check tomorrow if cronjob has completed correctly – misamisa Jan 30 '13 at 4:37

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.