LinuxQuestions.org
Help answer threads with 0 replies.
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 01-25-2013, 04:31 AM   #1
varunb
Member
 
Registered: Mar 2011
Location: Bangalore, INDIA
Distribution: opensuse, fedora
Posts: 135
Blog Entries: 1

Rep: Reputation: 1
Question Crontab stopped working


I use crontab -e to add the following:

*/1 * * * * /bin/echo "Hello" >> /home/varunb/hello.txt

But it does not work!


Logs says

PHP Code:

linux
-3jcp:/home/varunb # date ; tail -f /var/log/messages | grep cron
Fri Jan 25 10:18:07 GMT 2013
Jan 25 10
:17:41 linux-3jcp crontab[12870]: (rootREPLACE (root)
Jan 25 10:17:41 linux-3jcp crontab[12870]: (rootEND EDIT (root)
Jan 25 10:18:01 linux-3jcp crontab[13691]: (wwwrun) LIST (wwwrun)
Jan 25 10:18:01 linux-3jcp crontab[13693]: (wwwrun) LIST (wwwrun)
Jan 25 10:18:01 linux-3jcp crontab[13699]: (wwwrunREPLACE (wwwrun


command is fine and works if I run it directly on command prompt.
But for every minute i am testing crontab to work. Its not working.
Please suggest me.

Last edited by varunb; 01-25-2013 at 04:52 AM.
 
Old 01-25-2013, 06:18 AM   #2
shivaa
Senior Member
 
Registered: Jul 2012
Location: Grenoble, Fr.
Distribution: Sun Solaris, RHEL, Ubuntu, Debian 6.0
Posts: 1,797
Blog Entries: 4

Rep: Reputation: 286Reputation: 286Reputation: 286
(1) Your crontab entry says that "Hello" will run every minute... are you sure? Can your script finish withing a minute?

(2) Check your crontab entries, as:
Code:
~$ crontab -l
OR
~$ crontab -l <username>
(3) File /var/log/messages will not help much, instead check:
Code:
/var/log/cron.log
/var/log/cron
/var/spool/cron/ etc
 
Old 01-25-2013, 06:36 AM   #3
varunb
Member
 
Registered: Mar 2011
Location: Bangalore, INDIA
Distribution: opensuse, fedora
Posts: 135
Blog Entries: 1

Original Poster
Rep: Reputation: 1
Just to check whether cron tab is working or not???
That is single line command which is working on command prompt,
but if running through crontab it is not working. And yes i am running it every minute.

Code:
linux-3jcp:/home/varunb # ls
.bash_history  .viminfo
linux-3jcp:/home/varunb # date
Fri Jan 25 12:37:52 GMT 2013
linux-3jcp:/home/varunb # /bin/echo "Hello" >> /home/varunb/hello.txt
linux-3jcp:/home/varunb # cat hello.txt 
Hello
linux-3jcp:/home/varunb # date
Fri Jan 25 12:38:03 GMT 2013
linux-3jcp:/home/varunb # date
Fri Jan 25 12:39:10 GMT 2013
linux-3jcp:/home/varunb # cat hello.txt 
Hello
linux-3jcp:/home/varunb #

Also i am running as root, i don think there will be issue with the permissions.

checked below url even
http://stackoverflow.com/questions/7...ab-not-working

don know what is the problem???

and i don find

/var/log/cron.log
/var/log/cron
files.

only /var/spool/cron/

Code:
linux-3jcp:/var/spool/cron/tabs # pwd
/var/spool/cron/tabs
linux-3jcp:/var/spool/cron/tabs # ls
root  varunb  wwwrun
linux-3jcp:/var/spool/cron/tabs # cat root
#!/bin/sh
*/1 * * * * /bin/echo "Hello" >> /home/varunb/hello.txt

Last edited by varunb; 01-25-2013 at 06:40 AM.
 
Old 01-25-2013, 06:51 AM   #4
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.6, Centos 5.10
Posts: 16,462

Rep: Reputation: 2118Reputation: 2118Reputation: 2118Reputation: 2118Reputation: 2118Reputation: 2118Reputation: 2118Reputation: 2118Reputation: 2118Reputation: 2118Reputation: 2118
Which distro is this?
On my Centos system the crontab files are in /var/spool/cron.
Can you also check the ownerships, perms, SELinux, possibly also ACLs.
Re SELinux, do you seen anything in /var/log/audit dir?
If cron has an issue running a job, it usually emails the owner; in your case root.
 
Old 01-25-2013, 08:09 AM   #5
shivaa
Senior Member
 
Registered: Jul 2012
Location: Grenoble, Fr.
Distribution: Sun Solaris, RHEL, Ubuntu, Debian 6.0
Posts: 1,797
Blog Entries: 4

Rep: Reputation: 286Reputation: 286Reputation: 286
In different distributions, crontab entries are created in different ways.
Code:
*/1 * * * * /bin/echo "Hello" >> /home/varunb/hello.txt
It will work in Linux, but not in Solaris. So once specify your OS.
 
Old 01-27-2013, 11:23 PM   #6
varunb
Member
 
Registered: Mar 2011
Location: Bangalore, INDIA
Distribution: opensuse, fedora
Posts: 135
Blog Entries: 1

Original Poster
Rep: Reputation: 1
Quote:
Originally Posted by chrism01 View Post
Which distro is this?
On my Centos system the crontab files are in /var/spool/cron.
Can you also check the ownerships, perms, SELinux, possibly also ACLs.
Re SELinux, do you seen anything in /var/log/audit dir?
If cron has an issue running a job, it usually emails the owner; in your case root.
Code:
linux-3jcp:/home/varunb # cat /etc/issue

Welcome to SUSE Linux Enterprise Server 10 SP2 (x86_64) - Kernel \r (\l).
It was working for all the users and root user also, suddenly stoped working last week.
So just gave the example for root user, which is not working.

dont know what is the problem???
 
Old 01-30-2013, 02:21 AM   #7
varunb
Member
 
Registered: Mar 2011
Location: Bangalore, INDIA
Distribution: opensuse, fedora
Posts: 135
Blog Entries: 1

Original Poster
Rep: Reputation: 1
Wink

hello all,

crontab is working fine now.
problem i don know still, but the solution is:

i was trying to stop the cron service it was not at all stopping, the daemon was running
so did the process kill for cron and started again.

It started working.

below urls helpd me too. you can check out. I am closing this thread as solved.
thank you all. .

http://askubuntu.com/questions/17497...topped-working

http://www.cyberciti.biz/faq/howto-l...-restart-cron/
 
  


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
[SOLVED] A crontab notification that emails when a job has started, and stopped. bluesword1969 Programming 2 11-17-2011 03:02 PM
[SOLVED] Ubuntu 11.04 mic stopped working in HP G-32, but was working before.how to fix it? Highjo Ubuntu 4 08-08-2011 05:59 AM
Three Mobile Broadband was configured and working but it has now stopped working and Tinabarma Linux - Newbie 0 10-20-2008 07:36 AM
Crontab Stopped Working In Suse 10.2 Harpo SUSE / openSUSE 4 10-11-2007 08:31 PM
crontab suddenly stopped working corepuncher Linux - General 4 02-18-2005 05:57 PM


All times are GMT -5. The time now is 05:25 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