Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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/ 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?

share|improve this question

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/
share|improve this answer
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 posting your answer, you agree to the privacy policy and terms of service.

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