Knowledgebase

cron.daily help!

Posted by srinidhi95, 09-08-2010, 03:20 AM
Hi, I have a .sh file, which I need to run daily. I placed it in /etc/cron.daily But it was not running. Is any other I need to do? Thanks

Posted by barbus, 09-08-2010, 03:54 AM
Check /var/log/cron, shebang and script permissions.

Posted by akasharya, 09-08-2010, 03:56 AM
Is your script working when runs manually? did you check the permission of the script? whats showing in your log file? try to put this script on some different machine and see if it works or not.

Posted by kris1986, 09-08-2010, 07:01 AM
Did you configured any mail in your cron job? If so, are you receiving any error messages to mail? Also, please try running your cron manually and make sure it's working.

Posted by Mopman, 09-08-2010, 09:30 AM
And the obvious - is there a cron daemon running?

Posted by srinidhi95, 09-08-2010, 12:17 PM
Yes, Its running when tried manually. There is no trace in log file for that .sh file that I placed inside the /etc/corn.daily. All other crons of my users are running perfectly.

Posted by srinidhi95, 09-08-2010, 12:19 PM
Yes, cron deamon is running. All the crons of my users are running Last edited by srinidhi95; 09-08-2010 at 12:27 PM.

Posted by srinidhi95, 09-08-2010, 12:21 PM
The sh file is written the way to send mail if started to run and the log of the process at the end. But Im not getting the mail. So Im sure that It was not running.

Posted by barbus, 09-08-2010, 03:47 PM
Check your cron log.

Posted by akasharya, 09-09-2010, 03:26 AM
I hope your script file's name is not starting with .script or something like that. By the way is this redhat like OS or debian like OS? Last edited by akasharya; 09-09-2010 at 03:34 AM.

Posted by mugo, 09-11-2010, 05:00 AM
Check the dumb things...make sure the user actually running the cron (is it root, or a shell user?) has executable (x) permission. An instance where it would run for you, but not cron because of executable perms - -rw-r-xr-x root.myuser scriptfile.sh If you are "myuser", and execute it will run (myuser has x), if you are putting your cron entry under root user, then it doesn't have --x for root. Most ppl think of root as being able to do anything no matter what, but if root is the owner, and doesn't have at least --x on a file, it simply won't execute. Another little trick I use, instead of editing or placing files directly in cron, I create a "cronfile" with all the cron commands I want to run. If I add or change, you simply do a crontab -r then crontab /path/to/cronfile and it loads up your cron jobs, each with your time fields and commands. You then have one place to look and control things from, very easy to get a handle on your scheduled crons as a whole.



Was this answer helpful?

Add to Favourites Add to Favourites

Print this Article Print this Article

Also Read
htaccess not working (Views: 644)
OpenVZ, Xen or VMWare (Views: 529)


Language:

Client Login

Email

Password

Remember Me

Search