LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 10-26-2014, 07:27 AM   #1
Noble User
LQ Newbie
 
Registered: Oct 2014
Location: Northern VA
Posts: 5

Rep: Reputation: Disabled
Cron Job Not Running - Looks Like Cron Tried


Not a real newbie but still need some basic help here. Running Fedora, added a cron job in /etc/crontab. Did this with a simply "echo "hello" > hello.out previously to ensure that all was well. It was, I got the output. Then scheduled a "real" job for 6 AM this morning. It didn't run. Looked at other postings here, and found that I should check ps for "is cron running". Found /usr/sbin/crond -n
in the output.

Found an entry in /var/log/cron that referenced my script at the right time.

My script has a log that hasn't been touched though. Any ideas?
 
Old 10-26-2014, 08:56 AM   #2
grubby
LQ Newbie
 
Registered: Oct 2014
Distribution: Centos 6.5
Posts: 16

Rep: Reputation: Disabled
dunno how big the script is, but if possible could you paste it here?
Might be something in the code.
 
Old 10-26-2014, 10:45 AM   #3
Noble User
LQ Newbie
 
Registered: Oct 2014
Location: Northern VA
Posts: 5

Original Poster
Rep: Reputation: Disabled
No, but I failed to mention that the script runs fine, as root, when I run it from a command prompt. It's not the script.
 
Old 10-26-2014, 11:03 AM   #4
Noble User
LQ Newbie
 
Registered: Oct 2014
Location: Northern VA
Posts: 5

Original Poster
Rep: Reputation: Disabled
Ok, I was dumb. The script worked fine from a command prompt because I ran it from the right directory. Needed a "cd" in the script. Works now.
 
Old 10-26-2014, 11:11 AM   #5
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,331
Blog Entries: 55

Rep: Reputation: 3529Reputation: 3529Reputation: 3529Reputation: 3529Reputation: 3529Reputation: 3529Reputation: 3529Reputation: 3529Reputation: 3529Reputation: 3529Reputation: 3529
Looking at your "simple" cron job I would like to caution you to read up on shell scripting basics. While there's nothing wrong itself with a script like
Code:
echo "hello" > hello.out
it's too easy to make mistakes that can fubar your system real good.
 
Old 10-26-2014, 11:16 AM   #6
Noble User
LQ Newbie
 
Registered: Oct 2014
Location: Northern VA
Posts: 5

Original Poster
Rep: Reputation: Disabled
Well, that wasn't the actual script. Just "paraphrasing" as the purpose was to show that I was getting cron scripts to run. I've written literally hundreds over the years.
 
Old 10-26-2014, 11:20 AM   #7
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,331
Blog Entries: 55

Rep: Reputation: 3529Reputation: 3529Reputation: 3529Reputation: 3529Reputation: 3529Reputation: 3529Reputation: 3529Reputation: 3529Reputation: 3529Reputation: 3529Reputation: 3529
Quote:
Originally Posted by Noble User View Post
I've written literally hundreds over the years.
If you say so.
 
Old 10-26-2014, 11:26 AM   #8
Noble User
LQ Newbie
 
Registered: Oct 2014
Location: Northern VA
Posts: 5

Original Poster
Rep: Reputation: Disabled
Yeah, been working with UNIX since 82.
 
  


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
how to abort cron if the previous cron job not yet finished? Winanjaya Linux - Newbie 2 05-22-2012 07:44 PM
Cron job is not running dhirendrs Programming 1 08-25-2010 05:37 AM
adding a perl script to cron.daily / cron.d to setup a cron job CrontabNewBIE Linux - Software 6 01-14-2008 09:16 AM
cron job not running vincebs Linux - Software 34 10-30-2004 02:27 PM
Cron job not running? james_cwy Linux - Newbie 6 12-14-2003 09:24 PM


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