LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 06-27-2013, 02:37 PM   #1
eeps24
LQ Newbie
 
Registered: Jun 2013
Posts: 7

Rep: Reputation: Disabled
Question how to check if CRON is running?


I have script jobs that run in cron, all of sudden these jobs do not run. If I run the scripts manually they work fine, so this is telling me that CRON is the issue.

What should I be looking for/how can I tell if something isnt right?

if I do a cron -l I do see my scripts in there.
 
Old 06-27-2013, 02:39 PM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 21,962

Rep: Reputation: 5827Reputation: 5827Reputation: 5827Reputation: 5827Reputation: 5827Reputation: 5827Reputation: 5827Reputation: 5827Reputation: 5827Reputation: 5827Reputation: 5827
Quote:
Originally Posted by eeps24 View Post
I have script jobs that run in cron, all of sudden these jobs do not run. If I run the scripts manually they work fine, so this is telling me that CRON is the issue.

What should I be looking for/how can I tell if something isnt right?

if I do a cron -l I do see my scripts in there.
If the jobs WERE running through cron just fine, and have stopped, then the cron daemon may be stopped. You don't say what version/distro of Linux you're using, but "/etc/init.d/cron status" (as root) will tell you. If it's stopped, try to start it, and check the status again. You may also want to check the system logs and cron logs, to see if anything caused it to stop.
 
Old 06-27-2013, 02:59 PM   #3
eeps24
LQ Newbie
 
Registered: Jun 2013
Posts: 7

Original Poster
Rep: Reputation: Disabled
redhat...im going to ask a noob question, how do I switch to root?

would I do..


1. su root
2. then type "/etc/init.d/cron status"
 
Old 06-27-2013, 03:03 PM   #4
eeps24
LQ Newbie
 
Registered: Jun 2013
Posts: 7

Original Poster
Rep: Reputation: Disabled
i typed "service crond status" and it says its running.
 
Old 06-28-2013, 01:28 PM   #5
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 21,962

Rep: Reputation: 5827Reputation: 5827Reputation: 5827Reputation: 5827Reputation: 5827Reputation: 5827Reputation: 5827Reputation: 5827Reputation: 5827Reputation: 5827Reputation: 5827
Quote:
Originally Posted by eeps24 View Post
redhat...im going to ask a noob question, how do I switch to root?
would I do..

1. su root
2. then type "/etc/init.d/cron status"
Yes, you could, or type in "sudo -s", or "sudo /etc/init.d/cron status".
Quote:
Originally Posted by eeps24
i typed "service crond status" and it says its running.
You might want to try to restart it.

You still don't say what version/distro of Linux you're using, if the cron jobs have ever worked, if you've seen anything in the logs, or if there have been any changes lately. All could be parts of the problem(s).
 
Old 06-28-2013, 01:47 PM   #6
eeps24
LQ Newbie
 
Registered: Jun 2013
Posts: 7

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by TB0ne View Post

You still don't say what version/distro of Linux you're using, if the cron jobs have ever worked, if you've seen anything in the logs, or if there have been any changes lately. All could be parts of the problem(s).


redhat linux, not sure which version. The error log shows this....


/abc/v6.8/integrator/kshlib/setroot: line 19 /integrator/bin/abcsetenv: no such file or directory.

Line above this error is:
++ /integrator/bin/abcsetenv root ksh

Also looks like an error to me:
/home/abc/bin/clean.sh line 83 cd: /server/logs: no such file or directory.
 
Old 06-28-2013, 02:03 PM   #7
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 21,962

Rep: Reputation: 5827Reputation: 5827Reputation: 5827Reputation: 5827Reputation: 5827Reputation: 5827Reputation: 5827Reputation: 5827Reputation: 5827Reputation: 5827Reputation: 5827
Quote:
Originally Posted by eeps24 View Post
redhat linux, not sure which version. The error log shows this....

/abc/v6.8/integrator/kshlib/setroot: line 19 /integrator/bin/abcsetenv: no such file or directory.

Line above this error is:
++ /integrator/bin/abcsetenv root ksh

Also looks like an error to me:
/home/abc/bin/clean.sh line 83 cd: /server/logs: no such file or directory.
Ok, so based on that, are those paths correct? Have you looked at line 19 in the abcsetenv file? And again, has this EVER worked??
 
Old 06-30-2013, 11:59 PM   #8
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.10, Centos 7.5
Posts: 17,670

Rep: Reputation: 2487Reputation: 2487Reputation: 2487Reputation: 2487Reputation: 2487Reputation: 2487Reputation: 2487Reputation: 2487Reputation: 2487Reputation: 2487Reputation: 2487
As above and to check OS version, please post
Code:
cat /etc/*release*

uname -a
Errors should appear in /var/log/cron.
Note also that cron often emails the job owner or root if it has problems, so try 'mailx' as each of those users.
 
Old 07-01-2013, 08:40 PM   #9
kamalmin
LQ Newbie
 
Registered: Aug 2010
Posts: 5

Rep: Reputation: 0
if you are using Fedora/redhat/centos then

1) restart the crontab service

#service crond restart

2) check the user crontabl entry

#crontab -lu <user name>

eg
#crontab -lu testuser



if you are using suse linux then


1) restart the crontab service

#service cron restart

2) check the user crontabl entry

#crontab -lu <user name>

eg
#crontab -lu testuser
 
Old 07-02-2013, 08:43 AM   #10
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 21,962

Rep: Reputation: 5827Reputation: 5827Reputation: 5827Reputation: 5827Reputation: 5827Reputation: 5827Reputation: 5827Reputation: 5827Reputation: 5827Reputation: 5827Reputation: 5827
Quote:
Originally Posted by kamalmin View Post
if you are using Fedora/redhat/centos then

1) restart the crontab service
#service crond restart

2) check the user crontabl entry
#crontab -lu <user name>


if you are using suse linux then
The OP already said they were using Red Hat Linux, and the steps you posted were already suggested/tried. Please read the thread carefully before posting.
 
Old 07-02-2013, 09:09 AM   #11
gdr
Member
 
Registered: Jun 2013
Distribution: Mint KDE
Posts: 44

Rep: Reputation: Disabled
If there is an error during execution, Cron is sending it by email to root by default, but you can change it by adding a line like this to your crontab:

MAILTO=you@yourserver.com

It will probably end up in spam.

Another way is to read root's email locally via terminal, by installing an email client like Pine or Mutt, and running them as root.
 
Old 07-03-2013, 01:49 AM   #12
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.10, Centos 7.5
Posts: 17,670

Rep: Reputation: 2487Reputation: 2487Reputation: 2487Reputation: 2487Reputation: 2487Reputation: 2487Reputation: 2487Reputation: 2487Reputation: 2487Reputation: 2487Reputation: 2487
No need to install Pine/Mutt, try mailx or mail; these are usually in the default install.
 
Old 07-03-2013, 05:57 AM   #13
gdr
Member
 
Registered: Jun 2013
Distribution: Mint KDE
Posts: 44

Rep: Reputation: Disabled
Sure, mail/mailx will be good too, unless the number of emails collected is in the 10k range
 
  


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 to check PID from file and check whether process is running or not rajkiran183 Linux - Newbie 5 10-19-2012 11:28 AM
[SOLVED] scripts is not running thriugh cron ...manually running fine ghoshdastidar1980 Linux - Newbie 3 09-27-2012 02:42 AM
check active cron's JJJCR Linux - General 3 04-17-2012 12:37 AM
Vixie-Cron not running /etc/cron.d/ dman777 Linux - Software 1 02-09-2011 07:42 AM
cron - how to give priority to a task running in cron.daily? MeeLee Linux - Newbie 3 11-09-2010 08:41 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 05:08 PM.

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