cron: add procd listeners for crontabs
authorPaul Spooren <mail@aparcar.org>
Thu, 14 Jun 2018 01:21:11 +0000 (10:21 +0900)
committerJohn Crispin <john@phrozen.org>
Mon, 18 Jun 2018 16:21:20 +0000 (18:21 +0200)
Add procd file listeners to check files in `/etc/crontabs/`.

Also unified a bit the function style.

Signed-off-by: Paul Spooren <mail@aparcar.org>
package/utils/busybox/files/cron

index a201374276d301f4f5c355d509f25903a57f3c19..ca04a0c1707e5880e213d71d60402bbb9ef2720e 100755 (executable)
@@ -11,7 +11,7 @@ validate_cron_section() {
                'cronloglevel:uinteger'
 }
 
-start_service () {
+start_service() {
        [ -z "$(ls /etc/crontabs/)" ] && return 1
 
        loglevel="$(uci_get "system.@system[0].cronloglevel")"
@@ -29,10 +29,12 @@ start_service () {
 
        procd_open_instance
        procd_set_param command "$PROG" -f -c /etc/crontabs -l "${loglevel:-5}"
+       for crontab in /etc/crontabs/*; do
+                procd_set_param file "$crontab"
+       done
        procd_close_instance
 }
 
-service_triggers()
-{
+service_triggers() {
        procd_add_validation validate_cron_section
 }