Apps :: cron problems



Quote
Well Ok another dumb mistake. There are 6 fields for the time trigger and I only had 5 in crontab.

The only dumb mistakes are the ones you refuse to stop making. The rest are learning experiences. :)

I feel like an idiot, but why does this script have 6 time fields when the cron only has 5?

I've added another * to the end of the other 5 and things seem to work from initial testing, but I haven't found documentation on the6th field.

As shown in the perl script, /usr/local/bin/MyCron uses a slightly enhanced crontab

Code Sample
############################################################################
# This script reads /etc/crontab one line at a time and executes commands  
# in a manner similar to the real cron. Crontab entries are seven space    
# separated fields.  The first 6 fields are the time stuff (slightly      
# enhanced) and the remainder of the line is considered the command and    
# will be passed to the system (almost) as is for execution.              
# Crontab fields: MM HH DD MO WD YY <command>                      
# EG:   "32-46 15 12 5 * 2006 cmd"  (3:32pm to 3:46pm 12 May 2006)        
#       "10 8-17 * 5 * cmd"         (8:10am - 5:10pm everyday in May)  
#       "0 0/2 * * 6 cmd"      (every two hours, on the hour, on Saturday)  ############################################################################

Quote (roberts @ Oct. 08 2007,11:04)
As shown in the perl script, /usr/local/bin/MyCron uses a slightly enhanced crontab

Code Sample
############################################################################
# This script reads /etc/crontab one line at a time and executes commands  
# in a manner similar to the real cron. Crontab entries are seven space    
# separated fields.  The first 6 fields are the time stuff (slightly      
# enhanced) and the remainder of the line is considered the command and    
# will be passed to the system (almost) as is for execution.              
# Crontab fields: MM HH DD MO WD YY <command>                      
# EG:   "32-46 15 12 5 * 2006 cmd"  (3:32pm to 3:46pm 12 May 2006)        
#       "10 8-17 * 5 * cmd"         (8:10am - 5:10pm everyday in May)  
#       "0 0/2 * * 6 cmd"      (every two hours, on the hour, on Saturday)  ############################################################################

Ok,thanks for that, I should have seen that when I was looking at the script while I was getting errors.

Correct me if I'm wrong, but it appears that the second and third examples in the text from the script that you posted only contain 5 fields before the command. If this is allowed, why would my old crontab with 5 fields throw an error until I entered the 6th field?

Thanks again for your help

I didn't write the script. Just posted that comment section. But I would say you are correct. The only thing that I contributed was the sample test crontab


* * * * * * echo Cron timestamp `date` >> /tmp/crontest

Which has six.

Next Page...
original here.