smiley_kool Posted January 7, 2009 Share Posted January 7, 2009 hi can someone help me , how to run cron job.. do i need to install crontab for this. can someone tell me clearly hwo to implement cron Quote Link to comment https://forums.phpfreaks.com/topic/139812-cron/ Share on other sites More sharing options...
teng84 Posted January 7, 2009 Share Posted January 7, 2009 http://www.adminschoice.com/docs/crontab.htm Quote Link to comment https://forums.phpfreaks.com/topic/139812-cron/#findComment-731421 Share on other sites More sharing options...
smiley_kool Posted January 7, 2009 Author Share Posted January 7, 2009 http://www.adminschoice.com/docs/crontab.htm ya i read this link but i'm not clear .. Quote Link to comment https://forums.phpfreaks.com/topic/139812-cron/#findComment-731428 Share on other sites More sharing options...
neogranas Posted January 7, 2009 Share Posted January 7, 2009 On the system type this in the command line: crontab -e This will create the crontab if it is not already created, or append if one already exists. Next, you'll need to understand how the entries work. The first part is telling your system when to run the job. There are 5 switches to use: * * * * * | | | | +-What day of the week (0 being sunday) | | | +-What month (0 being january) | | +-What day of the month (0-31) | +-what hour (0-23) +-What minute (0-59) The * means that it's a wildcard, it will run no matter what that column represents so long as all other columns match. All 5 * means it will run every second of every day. Not a good thing, so do not run that. But say you want to run something on the hour every hour, say updatedb. 0 * * * * updatedb That will run the command updatedb every time the minute is 0. Say the same every 12 hours. 0 12 * * * updatedb I think you should get the idea from that. If you want to run a script, sometimes you may have to include the path to the the execution program for that script type, say PHP, and with that you can run the PHP script itself: 0 0 * * * /usr/bin/php -q /path/to/the/php/script.php The -q flag will make it run quietly and not push errors out and screw up other stuff, downfall is that it may not report any errors, so you won't know if it runs that well. I prefer to run shell scripts in my crontab and in that bash script, I give all output to a log file I create, that way I can go back and find out if things go wrong, or have a date stamp of when it worked. Hope that helps. Quote Link to comment https://forums.phpfreaks.com/topic/139812-cron/#findComment-731713 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.