cron problems


Forum: Apps
Topic: cron problems
started by: Big_Pc_Man

Posted by Big_Pc_Man on July 25 2007,01:45
dsl version 3.4

Seems there are two crontab choices: /opt/crontab and etc/crontab (symlink back to /knoppix/etc/crontab)

Both files are under root/root.

When executed in aterminal as su, they both come back with line1: ./events: permission denied.

Any ideas as to what is going wrong?

Big_Pc_Man

Posted by roberts on July 25 2007,04:43
And /KNOPPIX/etc/crontab links to /opt/crontab, all the same file.

Cron is too big to be in DSL and instead we use a perl script called MyCron located at /usr/local/bin

Start with the boot code cron  or manually with:

/usr/local/bin/MyCron &

Then take a look at /tmp/crontest to see the default test
Use your favorite DSL editor to edit /opt/crontab

Posted by Big_Pc_Man on July 25 2007,11:31
Thanks. When I activate mycron through the control panel it"freezes" up and I end up having to kill the panel process. By this I mean I can't access anything else in the panel like system stats to view what processes are running. Any ideas?
Posted by roberts on July 25 2007,14:31
Ah, yes!

The startup command within DSLpanel needs to be changed to "sudo MyCron &"

Posted by Big_Pc_Man on July 25 2007,17:32
Wow - MyCron is not happy with me!
By the way thanks for all the help.

1. I have changed the crontab file to be 2 * * * * /opt/myscript.sh
2. myscript is:

/opt/wget -v --output-document=/opt/myscript.log < http://www.mysite.com > >> /opt/terminalout.log 2>&1

3. Ran the script from the terminal and it works fine. Everything goes to the proper place.

4. As su in aterminal: /usr/local/bin/MyCron &

response: [1]  2854
second response: Argument """" isn't numeric in sprintf at /usr/local/bin/MyCron line 73, <CT> line 1.

Argument /opt/ isn't numeric in sprintf at /usr/local/bin/MyCron line 73, <CT> line 1.

At this point the cpu is running at 100% so I killed 2854 to get the system back.

What the heck is going on?

-----------------------------------------

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

Posted by lucky13 on July 25 2007,18:57
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. :)

Posted by bpsg119 on Oct. 08 2007,13:37
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.

Posted by roberts on Oct. 08 2007,15: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)  ############################################################################

Posted by bpsg119 on Oct. 08 2007,16:46
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

Posted by roberts on Oct. 08 2007,23:14
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.

Powered by Ikonboard 3.1.2a
Ikonboard © 2001 Jarvis Entertainment Group, Inc.