summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Spooren <mail@aparcar.org>2018-06-14 10:21:11 +0900
committerJohn Crispin <john@phrozen.org>2018-06-18 21:21:55 +0200
commit38eee4da942b450af3893fbf94d7c69c8a240ff1 (patch)
tree36dace9e1815eadad6f6d6dafce51f2a92fae0f7
parent56f66be113986c41f3950de892d8c17e6d67bd7a (diff)
downloadmtk-20170518-38eee4da942b450af3893fbf94d7c69c8a240ff1.zip
mtk-20170518-38eee4da942b450af3893fbf94d7c69c8a240ff1.tar.gz
mtk-20170518-38eee4da942b450af3893fbf94d7c69c8a240ff1.tar.bz2
cron: add procd listeners for crontabs
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> (cherry picked from commit cbf69fb2adced6096addbe6aeb54c1971c63dbe4)
-rwxr-xr-xpackage/utils/busybox/files/cron8
1 files changed, 5 insertions, 3 deletions
diff --git a/package/utils/busybox/files/cron b/package/utils/busybox/files/cron
index a201374..ca04a0c 100755
--- a/package/utils/busybox/files/cron
+++ b/package/utils/busybox/files/cron
@@ -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
}