LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-24-2011, 04:23 AM   #1
venom4u31
Member
 
Registered: Oct 2011
Distribution: Debian 6
Posts: 47

Rep: Reputation: Disabled
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?
 
Old 11-24-2011, 04:50 AM   #2
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976
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")
 
1 members found this post helpful.
Old 11-24-2011, 09:36 AM   #3
venom4u31
Member
 
Registered: Oct 2011
Distribution: Debian 6
Posts: 47

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by colucix View Post
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Script won't run in crontab.... only manually ScorchPipe Linux - Newbie 7 03-22-2011 11:11 AM
Script won't run in crontab rastellig Linux - Software 2 03-25-2009 10:18 AM
script won't run in crontab(centos 5) ncsuapex Programming 2 03-09-2008 07:55 PM
why won't my crontab execute the commands? dannemil Linux - Newbie 4 02-12-2008 06:25 PM
Crontab - How can i run the scheduled file? - Please help me b:z Linux - General 6 04-01-2005 06:23 AM


All times are GMT -5. The time now is 08:49 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration