LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Cron Job Not Running - Looks Like Cron Tried (https://www.linuxquestions.org/questions/linux-newbie-8/cron-job-not-running-looks-like-cron-tried-4175523372/)

Noble User 10-26-2014 06:27 AM

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?

grubby 10-26-2014 07:56 AM

dunno how big the script is, but if possible could you paste it here?
Might be something in the code.

Noble User 10-26-2014 09:45 AM

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.

Noble User 10-26-2014 10:03 AM

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.

unSpawn 10-26-2014 10:11 AM

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.

Noble User 10-26-2014 10:16 AM

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.

unSpawn 10-26-2014 10:20 AM

Quote:

Originally Posted by Noble User (Post 5259837)
I've written literally hundreds over the years.

If you say so.

Noble User 10-26-2014 10:26 AM

Yeah, been working with UNIX since 82.


All times are GMT -5. The time now is 03:35 AM.