jaymc Posted January 19, 2008 Share Posted January 19, 2008 For some reason, cron jobs appear to be running multiple times I have one in there which is wget http://site.com (example) Sometimes I can see that running 5 times via process list It also used to do it with a mysqldump I had, which would crash mysql as it was being run 5 times consequatively Any ideas what may be causing that? Quote Link to comment https://forums.phpfreaks.com/topic/86845-solved-cron-job/ Share on other sites More sharing options...
Daniel0 Posted January 19, 2008 Share Posted January 19, 2008 How often is it supposed to run? Perhaps it doesn't end before it starts again? Quote Link to comment https://forums.phpfreaks.com/topic/86845-solved-cron-job/#findComment-443842 Share on other sites More sharing options...
neylitalo Posted January 19, 2008 Share Posted January 19, 2008 Can you show us the cronjob? Quote Link to comment https://forums.phpfreaks.com/topic/86845-solved-cron-job/#findComment-443863 Share on other sites More sharing options...
jaymc Posted January 19, 2008 Author Share Posted January 19, 2008 Here is one */1 * * * * wget -q http://site.com/cleanchatusers.php That takes less than a second to run, should run every minute Another, which runs every 7 mins * 7 * * * wget -q http://site.com/cleanmessages.php Quote Link to comment https://forums.phpfreaks.com/topic/86845-solved-cron-job/#findComment-443872 Share on other sites More sharing options...
neylitalo Posted January 19, 2008 Share Posted January 19, 2008 Cronjob syntax is as follows: minute hour day-of-month month-of-year day-of-week So a task that runs every minute would be as follows: * * * * * task A task that runs every seven minutes would be as follows: */7 * * * * task The way you've got it set up, the first one will technically run every minute, although the /1 is unnecessary. However, the second one will only run at 07:00 each day. This is all assuming that your cron manager follows the POSIX cron standards. Quote Link to comment https://forums.phpfreaks.com/topic/86845-solved-cron-job/#findComment-443885 Share on other sites More sharing options...
jaymc Posted January 19, 2008 Author Share Posted January 19, 2008 Sorry, my example of * 7 * * * wget -q http://site.com/cleanmessages.php Is correct, although I do have one in there marked as */7 * * * * wget -q http://site.com/stuff.php Which is duplicating multiple times. aswell as the one that runs every minute Any ideas? Quote Link to comment https://forums.phpfreaks.com/topic/86845-solved-cron-job/#findComment-443891 Share on other sites More sharing options...
jaymc Posted January 22, 2008 Author Share Posted January 22, 2008 Ok, I was right about cron running multiple times I have just come on today to find my server almost dead after it had run and was still running my backup.sh script This involves large copies and gzips aswell as DB locks I seen 3 instances of it in process list, aswell as 120 wgets which run every minute and only takes 1 second Hope some one knows what could cause cron to do this? Quote Link to comment https://forums.phpfreaks.com/topic/86845-solved-cron-job/#findComment-445921 Share on other sites More sharing options...
jaymc Posted January 22, 2008 Author Share Posted January 22, 2008 Logs Jan 22 06:12:01 hostname crond[17863]: (root) CMD (cd /home/backups && ./backup.sh) Jan 22 06:13:01 hostname crond[17891]: (root) CMD (cd /home/backups && ./backup.sh) Jan 22 06:14:01 hostname crond[17916]: (root) CMD (cd /home/backups && ./backup.sh) Jan 22 06:15:01 hostname crond[17964]: (root) CMD (/usr/bin/mrtg /etc/mrtg/mrtg.cfg --lock-file /var/lock/mrtg/mrtg_l --con$ Jan 22 06:15:01 hostname crond[17968]: (root) CMD (cd /home/backups && ./backup.sh) Jan 22 06:16:04 hostname crond[18003]: (root) CMD (cd /home/backups && ./backup.sh) Jan 22 06:16:04 hostname crond[18004]: (root) CMD (wget -q http://hostname.co.uk/dbqueries/index.php) Jan 22 06:17:02 hostname crond[18041]: (root) CMD (wget -q http://hostname.co.uk/dbqueries/cleanchatusers.php) Jan 22 06:17:02 hostname crond[18042]: (root) CMD (cd /home/backups && ./backup.sh) Jan 22 06:18:04 hostname crond[18074]: (root) CMD (php -f /home/sitename/includes/cache/dynamic/homepage.php) Jan 22 06:18:04 hostname crond[18075]: (root) CMD (cd /home/backups && ./backup.sh) Jan 22 06:18:04 hostname crond[18076]: (root) CMD (wget -q http://hostname.co.uk/dbqueries/cleanchatusers.php) Jan 22 06:19:01 hostname crond[18114]: (root) CMD (wget -q http://hostname.co.uk/dbqueries/cleanchatusers.php) Jan 22 06:19:01 hostname crond[18115]: (root) CMD (cd /home/backups && ./backup.sh) Jan 22 06:20:01 hostname crond[18146]: (root) CMD (/usr/bin/mrtg /etc/mrtg/mrtg.cfg --lock-file /var/lock/mrtg/mrtg_l --con$ Jan 22 06:20:01 hostname crond[18149]: (root) CMD (cd /home/backups && ./backup.sh) Jan 22 06:21:03 hostname crond[18181]: (root) CMD (cd /home/backups && ./backup.sh) Jan 22 06:22:01 hostname crond[18207]: (root) CMD (cd /home/backups && ./backup.sh) Jan 22 06:23:04 hostname crond[18237]: (root) CMD (cd /home/backups && ./backup.sh) Jan 22 06:24:02 hostname crond[18269]: (root) CMD (cd /home/backups && ./backup.sh) backup.sh should be run once via this command in crontab * 6 * * * cd /home/backups && ./backup.sh Any idea what this is also? its not in crontab (crontab -e) Jan 22 06:20:01 hostname crond[18146]: (root) CMD (/usr/bin/mrtg /etc/mrtg/mrtg.cfg --lock-file /var/lock/mrtg/mrtg_l --con$ Hope someone can help.. Quote Link to comment https://forums.phpfreaks.com/topic/86845-solved-cron-job/#findComment-446114 Share on other sites More sharing options...
jaymc Posted January 22, 2008 Author Share Posted January 22, 2008 Here is my cron conf GNU nano 1.2.4 File: crontab SHELL=/bin/bash PATH=/sbin:/bin:/usr/sbin:/usr/bin MAILTO="" HOME=/ # run-parts 01 * * * * root run-parts /etc/cron.hourly 02 4 * * * root run-parts /etc/cron.daily 22 4 * * 0 root run-parts /etc/cron.weekly 42 4 1 * * root run-parts /etc/cron.monthly Quote Link to comment https://forums.phpfreaks.com/topic/86845-solved-cron-job/#findComment-446118 Share on other sites More sharing options...
neylitalo Posted January 22, 2008 Share Posted January 22, 2008 backup.sh should be run once via this command in crontab * 6 * * * cd /home/backups && ./backup.sh I'm not sure what you're trying to accomplish with this, but as it stands, it's going to run that job every minute in the 06 hour. So it'll run it at 06:00, 06:01, 06:02, and so on. The same thing will happen with your * 7 * * *. You need to change them to 0 6 * * * and 0 7 * * *, respectively. Quote Link to comment https://forums.phpfreaks.com/topic/86845-solved-cron-job/#findComment-446225 Share on other sites More sharing options...
jaymc Posted January 23, 2008 Author Share Posted January 23, 2008 CHeers Quote Link to comment https://forums.phpfreaks.com/topic/86845-solved-cron-job/#findComment-447185 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.