Search Members Help

» Welcome Guest
[ Log In :: Register ]

Mini-ITX Boards Sale, Fanless BareBones Mini-ITX, Bootable 1G DSL USBs, 533MHz Fanless PC <-- SALE $200 each!
Get The Official Damn Small Linux Book. DSL Market , Great VPS hosting provided by Tektonic
 

[ Track this topic :: Email this topic :: Print this topic ]

reply to topic new topic new poll
Topic: Cron problems, How to get cron to execute commands< Next Oldest | Next Newest >
rfka01 Offline





Group: Members
Posts: 7
Joined: Nov. 2007
Posted: Dec. 01 2007,09:45 QUOTE

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
Back to top
Profile PM 
lucky13 Offline





Group: Members
Posts: 1478
Joined: Feb. 2007
Posted: Dec. 01 2007,14:18 QUOTE

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?


--------------
"It felt kind of like having a pitbull terrier on my rear end."
-- meo (copyright(c)2008, all rights reserved)
Back to top
Profile PM WEB 
rfka01 Offline





Group: Members
Posts: 7
Joined: Nov. 2007
Posted: Dec. 01 2007,19:35 QUOTE

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
Back to top
Profile PM 
roberts Offline





Group: Members
Posts: 4983
Joined: Oct. 2003
Posted: Dec. 01 2007,19:44 QUOTE

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)
############################################################################
Back to top
Profile PM WEB 
rfka01 Offline





Group: Members
Posts: 7
Joined: Nov. 2007
Posted: Dec. 01 2007,22:31 QUOTE

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
Back to top
Profile PM 
4 replies since Dec. 01 2007,09:45 < Next Oldest | Next Newest >

[ Track this topic :: Email this topic :: Print this topic ]

 
reply to topic new topic new poll
Quick Reply: Cron problems

Do you wish to enable your signature for this post?
Do you wish to enable emoticons for this post?
Track this topic
View All Emoticons
View iB Code