#!/bin/sh /etc/rc.common START=50 run_reboot() { local enable config_get_bool enable $1 enable if [ $enable = 1 ]; then local minute local hour config_get week $1 week config_get minute $1 minute config_get hour $1 hour if [ $minute = 0 ] ; then minute="00" fi if [ $week = 7 ] ; then week="*" fi sed -i '/reboot/d' /etc/crontabs/root >/dev/null 2>&1 /etc/init.d/cron restart echo "$minute $hour * * $week sleep 5 && touch /etc/banner && reboot" >> /etc/crontabs/root echo "Auto REBOOT has started." else sed -i '/reboot/d' /etc/crontabs/root >/dev/null 2>&1 /etc/init.d/cron restart echo "Auto REBOOT has started." fi } start() { config_load autoreboot config_foreach run_reboot login } stop() { echo "Auto REBOOT has stoped." }