www.centos.org Forum Index CentOS 5 - Server Support Strange issue with crond in /etc/cron.d
|
Bottom Previous Topic Next Topic |
| |
|
|
|---|
| Poster | Thread |
|---|
|
Re: Strange issue with crond in /etc/cron.d | #2 |
|
|---|---|---|---|
|
Moderator
![]()
Joined: 2006/12/13
From Tidewater Virginia, North America
Posts: 3404
|
Drop the "root". |
||
|
_________________
Phil Required reading: FAQ & Readme first ; Search hint: google "your topic site:centos.org"; Smart Questions |
|||
Posted on: 2009/11/6 13:09
|
|||
|
Re: Strange issue with crond in /etc/cron.d | #3 |
|
|---|---|---|---|
|
Regular Board Member
![]()
Joined: 2009/9/24
From Brighton, UK
Posts: 79
|
No, the OP is in /etc/cron.d not in /etc/cron.daily so the root is needed.
I think you should look in /var/log/cron and see if the script is being invoked. If it is then there is a problem within your script and the most likely answer then is that you are missing full paths to the executables that you are running inside the script. Cron scripts are invoked with a very stripped down path and few environment variables so what works from a command line may not necessarily work from cron. Make sure that you use, for example, '/bin/ls' and not just 'ls' inside your cron script or set the PATH to include the locations you want searched. |
||
Posted on: 2009/11/6 13:38
|
|||
|
Re: Strange issue with crond in /etc/cron.d | #4 |
|
|---|---|---|---|
|
Moderator
![]()
Joined: 2006/12/13
From Tidewater Virginia, North America
Posts: 3404
|
OK, did not read carefully enough. I always use "crontab -e" ("man crontab"; "man 5 crontab") and the user field is not used there. Using "crontab -e" should work following my example as root.
Also correct that adding full paths is often necessary in cron jobs, and will never hurt, but don't think that's required for /bin and /usr/bin - at least I have crontab scripts that do not use full paths for things that live there. I believe full paths are required for /sbin, /usr/sbin, and pretty much anywhere else. |
||
|
_________________
Phil Required reading: FAQ & Readme first ; Search hint: google "your topic site:centos.org"; Smart Questions |
|||
Posted on: 2009/11/6 13:59
|
|||
|
Re: Strange issue with crond in /etc/cron.d | #5 |
|
|---|---|---|---|
|
Peeking in the Member Window
![]()
Joined: 2006/5/3
From
Posts: 19
|
Thank you for your help guys. I wasn't sure where cron logged, I didn't think to look for one as I've never had a cron job not work(duh!)! Anyway, after looking through the log I have this entry.
(*system*) BAD FILE MODE (/etc/cron.d/notifyoncall) Apparently my permissions of 755 weren't well liked. I chmod'ed my definition file to 644 and everything works perfectly. Thanks for your help guys. It's greatly appreciated. I have one last question. My root mail is filling up and I don't want notification every time my script runs. Can I redirect stdout to /dev/null or is there some other way to avoid it putting something in root's mail inbox? Thanks, Todd |
||
Posted on: 2009/11/7 2:45
|
|||
|
Re: Strange issue with crond in /etc/cron.d | #6 |
|
|---|---|---|---|
|
Professional Board Member
![]()
Joined: 2007/10/22
From ~/Earth/UK/England/Suffolk
Posts: 4294
|
Quote:
Can I redirect stdout to /dev/null or is there some other way to avoid it putting something in root's mail inbox? All output produced by a cron job is, unless explicitly handled, mailed to root (or another ID, if the MAILTO= line is modified). So, if you do not need to see the output, just redirect it to the null device. If you would like to keep the output of the last run of the cron job, redirect the output to a file. |
||
Posted on: 2009/11/7 11:22
|
|||
Top Previous Topic Next Topic |
|



Topic options
Print Topic
Threaded
Newest First
tnine






You cannot start a new topic.
You can view topic.