LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Configured Cron job executed every hour is instead executed every minute for 10m (https://www.linuxquestions.org/questions/linux-software-2/configured-cron-job-executed-every-hour-is-instead-executed-every-minute-for-10m-943933/)

markings 05-08-2012 02:37 PM

Configured Cron job executed every hour is instead executed every minute for 10m
 
Hello,

I found a strange anomaly where Cron jobs are being executed every minute monetarily for approximately 15 minutes instead of their scheduled time. I like to understand why? Are there any configuration parameters that I can modify to adjust this behavior? The Cron job should only be executed once at the assigned scheduled time regardless the exit status of the job. Any assistance would be greatly appreciated.

Best Regards

chrism01 05-08-2012 08:13 PM

For a start, show the cronjob entry, secondly double-check there are no other cron entries for that ie user (inc root) entries are usually in files under /var/spool/cron, but system cron jobs are in any of these under /etc
Code:

-rw-r--r--.  1 root root    541 Mar  4  2011 anacrontab
drwxr-xr-x.  2 root root  4096 Jan 11 15:28 cron.d
drwxr-xr-x.  2 root root  4096 Apr  4 15:19 cron.daily
-rw-r--r--.  1 root root      0 Mar  4  2011 cron.deny
drwxr-xr-x.  2 root root  4096 Jan 11 15:28 cron.hourly
drwxr-xr-x.  2 root root  4096 Jun  4  2011 cron.monthly
-rw-r--r--.  1 root root    537 Jan 11 15:33 crontab
drwxr-xr-x.  2 root root  4096 Jun  4  2011 cron.weekly


markings 05-13-2012 05:28 AM

Hello,

The specified cron job is in bold and run as root:

Code:

05:59:11:/etc> crontab -u root -l
OPENZ_PATH = /usr/local/share/bombshellz/openZ/OpenZ.php
0 * * * * /etc/webmin/bandwidth/rotate.pl
# 0-59 * * * * /usr/sbin/logwatch --service dmeventd
# 0-59 * * * * root /usr/sbin/logwatch --service dmeventd
# 0,5,10,15,20,25,30,35,40,45,50,55 * * * * root /usr/sbin/logwatch --service dmeventd
@daily /usr/sbin/logwatch #Daily Log summary
@daily /usr/bin/rkhunter --cronjob
@hourly /usr/local/bin/php /usr/local/share/bombshellz/openZ/Library/Services/CheckGCCTimedUsers.php 
* 0,5,10,15,20 * * * /usr/local/bin/php /usr/local/share/bombshellz/openZ/Library/Services/TimeCheck.php $OPENZ_PATH
@hourly /usr/local/bin/php /usr/local/share/bombshellz/openZ/Library/Services/CheckUsersV2.php $OPENZ_PATH

As you can see, the job is only declared once. Rummaging through directories, this is what I found:

Code:

05:59:11:/etc> ls /var/spool/cron
allow  lastrun  tabs
05:59:11:/etc> cat /var/spool/cron/lastrun/cron.daily
05:59:11:/etc> ls /var/spool/cron/tabs/
root  stiny0
05:59:11:/etc> ls cron.*
cron.allow

cron.d:
dmeventd  dmeventd.rpmsave  sysstat  vnstat

cron.daily:
0logwatch  logrotate          suse-do_mandb            suse.de-backup-rpmdb  suse.de-clean-tmp  suse.de-rkhunter
afick_cron  suse-clean_catman  suse.de-backup-rc.config  suse.de-check-battery  suse.de-cron-local

cron.hourly:

cron.monthly:

cron.weekly:

Ideas?

rknichols 05-13-2012 08:17 AM

Quote:

Originally Posted by markings (Post 4677151)
Code:

* 0,5,10,15,20 * * * /usr/local/bin/php /usr/local/share/bombshellz/openZ/Library/Services/TimeCheck.php $OPENZ_PATH

You asked for the job to be run every minute (first field is "*") during the specified hours. Replace that first "*" with some number in the range 0..59 .

markings 05-13-2012 05:43 PM

Hello,

I'm not sure how I missed that when I was reading the cron syntax. Thanks for the Help.

Best Regards


All times are GMT -5. The time now is 12:26 AM.