LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Crontab won't run scheduled commands. (Debian 6) (https://www.linuxquestions.org/questions/linux-newbie-8/crontab-wont-run-scheduled-commands-debian-6-a-915280/)

venom4u31 11-24-2011 03:23 AM

Crontab won't run scheduled commands. (Debian 6)
 
I used the crontab command to run a task every minute.
the crontab for my user looks like this:
Code:

* * * * * echo "Hello World"
The problem is that even after I restart the system nothing happens. Even if I use any other command instead of echo. Can you please tell me how to make the crontab file work properly?

colucix 11-24-2011 03:50 AM

How do you tell it's not working? Since the cron job doesn't redirect standard output to a file, it will be sent to the user's mailbox by default. Have you checked it?

If the user did not received any mail, first you have to establish if the cron daemon is running (as root)
Code:

# /etc/init.d/crond status
or
Code:

# ps -C crond
Then check the cron logs to see if the job did actually run or not. You should see entries like this in /var/log/cron:
Code:

Nov 24 09:00:01 host CROND[30691]: (user) CMD (echo "Hello World")
Nov 24 09:01:01 host CROND[30691]: (user) CMD (echo "Hello World")


venom4u31 11-24-2011 08:36 AM

Quote:

Originally Posted by colucix (Post 4532597)
How do you tell it's not working? Since the cron job doesn't redirect standard output to a file, it will be sent to the user's mailbox by default. Have you checked it?

If the user did not received any mail, first you have to establish if the cron daemon is running (as root)
Code:

# /etc/init.d/crond status
or
Code:

# ps -C crond
Then check the cron logs to see if the job did actually run or not. You should see entries like this in /var/log/cron:
Code:

Nov 24 09:00:01 host CROND[30691]: (user) CMD (echo "Hello World")
Nov 24 09:01:01 host CROND[30691]: (user) CMD (echo "Hello World")


Wow... in a few words you pointed exactly what I've missed in hours of documentation. It works just fine now... Thanks a lot.


All times are GMT -5. The time now is 11:37 PM.