TheProjecter / x-wrt

Automatically exported from code.google.com/p/x-wrt
0 stars 0 forks source link

cron won't execute changed crontab entries #131

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
pre. ( if cron is disabled, enable cron)
1. navigate to system -> crontabs 
2. enter a new crontab entry or change an existing
3. save and apply

What is the expected output? What do you see instead?
The changed or new entry won't be executed at te given time
(on new entries it will never ( if you donot reboot ) on changed entries 
the old time will still be used.)

What version of the product are you using? On what operating system and web
browser?
FF 3.0.5 Mac OSX

Please provide any additional info below.
a) I did not find any already opened issue, so I filed this one.
b) I did some research:
-> /etc/config/crontab is updated as expected
-> /etc/crontabs/root is not updated ... 
( need to call /etc/init.d/crontab, which itself does not notify cron
 about the change )

sugestion:
call /etc/init.d/crontab after applying changes ..
change /etc/init.d/crontab to
write a tempfile and then read it with crontab. this will inform cron.
(maybe try using the cron.update mechanism; but crontab.c of busybox looks
like it tries to avoid a racecondition)
<--- crontab might be changed as follows:
--- crontab     Sun Mar  1 17:20:52 2009
+++ crontab.orig        Sun Mar  1 17:12:23 2009
@@ -1,5 +1,4 @@
 #!/bin/sh /etc/rc.common
-set -x
 # Copyright (C) 2008 x-wrt.org
 START=49

@@ -17,9 +16,9 @@

 start () {
        config_load crontabs
-       echo "# WARNING: this is an auto generated file, please use uci to
set cron entries" > /tmp/crontab_root
-       echo "# this file is generated from /etc/config/crontabs" >>
/tmp/crontab_root
-       echo >> /tmp/crontab_root
+       echo "# WARNING: this is an auto generated file, please use uci to
set cron entries" > /etc/crontabs/root
+       echo "# this file is generated from /etc/config/crontabs" >>
/etc/crontabs/root
+       echo >> /etc/crontabs/root

        for crontab in $CRONTABS_cfg; do
                config_get MINUTES $crontab minutes
@@ -31,9 +30,7 @@
                config_get ENABLED $crontab enabled

                if [ "$MINUTES" != "" ] && [ "$HOURS" != "" ] && [ "$DAYS"
!= "" ] && [ "$MONTHS" != "" ] && [ "$WEEKDAYS" != "" ] && [ "$COMMAND" !=
"" ] && [ "$ENABLED" = "1" ]; then
-                       echo $MINUTES" "$HOURS" "$DAYS" "$MONTHS"
"$WEEKDAYS" "$COMMAND  >> /tmp/crontab_root
+                       echo $MINUTES" "$HOURS" "$DAYS" "$MONTHS"
"$WEEKDAYS" "$COMMAND  >> /etc/crontabs/root
                fi
        done
-       crontab /tmp/crontab_root
-       rm /tmp/crontab_root
 }

Original issue reported on code.google.com by Lo...@fahr-zur-hoelle.org on 1 Mar 2009 at 4:49

GoogleCodeExporter commented 8 years ago
Sorry, I forgot:
opkg search /etc/init.d/crontab
webif - 0.3-4709 - /etc/init.d/crontab

Original comment by Lo...@fahr-zur-hoelle.org on 1 Mar 2009 at 4:50