Cron problems


Forum: Other Help Topics
Topic: Cron problems
started by: rfka01

Posted by rfka01 on Dec. 01 2007,09:45
Hello everybody,
I'm using DSL 4.1RC3. I have enabled cron with the boot parameter, and the test line is executed as can be seen in /tmp/crontest.

When I add lines to /opt/crontab or /etc/crontab, they are being ignored.

I want something like this to automatically start/stop wireless lan every hour and shutdown the machine in the night

0  *  * * * /home/dsl/net-on.sh
10 *  * * * /home/dsl/net-off.sh
30 23 * * * shutdown now

The shell scripts can be executed manually, but nothing happens when I enter the lines into the crontab file.

What am I missing?

Thanks, Robert

Posted by lucky13 on Dec. 01 2007,14:18
Set up a symlink as /usr/bin/editor (I think that's where it goes; run the following command and it should tell you if it doesn't find what it's looking for) for your editor of choice. Try running
crontab -e

This will open your editor with your user (dsl) crontab. Edit it as you see fit. Save. It should work. Mine does.

Are net-on.sh and net-off.sh executable (check permissions)? Is there a problem with those scripts? Can you get your computer halt if you add the -h flag?

Posted by rfka01 on Dec. 01 2007,19:35
Hi, I set up the symlink. Is the cron that is enabled with the boot parameter in DSL a fully fledged cron? The crontab command does not seem to exist, so editing the crontab file directly should work.

Both shell scripts are executable and work well when executed manually as does shutdown now -h.

Entering the commands into /opt/crontab has no effect.

Robert

Posted by roberts on Dec. 01 2007,19:44
It is not real cron. That is too big. We use a perl script /usr/local/bin/MyCron which is 'enhanced', i.e., extra field see the embedded notes:

############################################################################
# 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 rfka01 on Dec. 01 2007,22:31
Riddle solved.
The test line entering the timestamp into the crontest file was preventing the execution of the following lines. After removing it from crontab, all other commands were executed properly.

Thanks, everybody.

Robert

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