added lang /lib pkgs
[librewrt/.git] / packages / xwrt / webif / files / etc / init.d / crontab
1 #!/bin/sh /etc/rc.common
2 # Copyright (C) 2008 x-wrt.org
3 START=49
4
5 config_cb() {
6         local cfg_type="$1"
7         local cfg_name="$2"
8
9         case "$cfg_type" in
10                 crontab)
11                         append CRONTABS_cfg "$cfg_name"
12                 ;;
13                 
14         esac
15 }
16
17 start () {
18         config_load crontabs
19         echo "# WARNING: this is an auto generated file, please use uci to set cron entries" > /etc/crontabs/root
20         echo "# this file is generated from /etc/config/crontabs" >> /etc/crontabs/root
21         echo >> /etc/crontabs/root
22         
23         for crontab in $CRONTABS_cfg; do
24                 config_get MINUTES $crontab minutes
25                 config_get HOURS $crontab hours
26                 config_get DAYS $crontab days
27                 config_get MONTHS $crontab months
28                 config_get WEEKDAYS $crontab weekdays
29                 config_get COMMAND $crontab command
30                 config_get ENABLED $crontab enabled
31
32                 if [ "$MINUTES" != "" ] && [ "$HOURS" != "" ] && [ "$DAYS" != "" ] && [ "$MONTHS" != "" ] && [ "$WEEKDAYS" != "" ] && [ "$COMMAND" != "" ] && [ "$ENABLED" = "1" ]; then
33                         echo $MINUTES" "$HOURS" "$DAYS" "$MONTHS" "$WEEKDAYS" "$COMMAND >> /etc/crontabs/root
34                 fi
35         done
36 }