mirror of
https://github.com/coolsnowwolf/lede.git
synced 2025-04-16 14:23:38 +00:00
40 lines
740 B
Bash
Executable File
40 lines
740 B
Bash
Executable File
#!/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 = 0 ] ; then
|
|
week="*"
|
|
fi
|
|
sed -i '/reboot/d' /etc/crontabs/root >/dev/null 2>&1
|
|
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
|
|
echo "Auto REBOOT has started."
|
|
fi
|
|
}
|
|
|
|
start()
|
|
{
|
|
config_load autoreboot
|
|
config_foreach run_reboot login
|
|
}
|
|
|
|
stop()
|
|
{
|
|
echo "Auto REBOOT has stoped."
|
|
}
|