update 2026-09-26 11:07:27

This commit is contained in:
action committed 2026-09-26 11:07:27 +08:00
1 parent 7b88b273d0
commit 97ae9f68da
4898 files changed
-1712274

No files matched your search

@@ -1,7 +0,0 @@
config main
option enable '0'
option minute '10'
option hour '6'
option week '6'
option once '0'
@@ -1,24 +0,0 @@
#!/bin/sh /etc/rc.common
START=50
run_reboot()
{
if [ -e "/usr/bin/dorboot" ]; then
chmod +x /usr/bin/dorboot
/usr/bin/dorboot 2 &
else
logger "Timed Reboot: file missing, please reinstall.Settings don't work."
sed -i '/dorboot/d' /etc/crontabs/root >/dev/null 2>&1 || exit 1
fi
}
start()
{
run_reboot
}
stop()
{
logger "Timed Reboot has stoped, but do nothing. if you need to clear settings, goto system -> timedreboot and make it disable."
echo "Timed Reboot has stoped, but do nothing. if you need to clear settings, goto system -> timedreboot and make it disable." > /tmp/timedreboot.log
}
-130
View File
@@ -1,130 +0,0 @@
#!/bin/bash
# [K] (C)2020
# http://github.com/kongfl888/luci-app-timedreboot
sleep 5s
if [ ! -e "/etc/config/timedreboot" ]; then
echo "timedreboot cfg is not exit" >> /tmp/timedreboot.log
logger "timedreboot cfg is not exit. Stop!"
exit 1
fi
renable=1
# --------function--------
get_cfg_value(){
v=`uci get timedreboot.@main[0].$1 2>/dev/null`
if [ ! -z "$v" ]; then
echo "$v"
else
echo "1"
fi
}
get_cron_timestr() {
str1=`cat /etc/crontabs/root | grep "dorboot"`
m1=`echo "$str1" | cut -d " " -f 1`
h2=`echo "$str1" | cut -d " " -f 2`
w5=`echo "$str1" | cut -d " " -f 5`
echo "$m1 $h2 * * $w5"
}
get_cron_parameter() {
str=`cat /etc/crontabs/root | grep "dorboot" | cut -d " " -f 7`
echo "$str"
}
clear_cron(){
sed -i '/dorboot/d' /etc/crontabs/root >/dev/null 2>&1
/etc/init.d/cron restart
}
set_cron() {
echo "Timed Reboot is set." > /tmp/timedreboot.log
clear_cron
echo "${1} /usr/bin/dorboot ${2}" >> /etc/crontabs/root
}
rebootsys() {
if [ "${1}" = "1" ]; then
uci set timedreboot.@main[0].enable="0"
uci set timedreboot.@main[0].once="0"
uci commit timedreboot
clear_cron
fi
sleep 5s
touch /etc/banner
sleep 5s
reboot
}
justcfg() {
local minute=`get_cfg_value "minute"`
local hour=`get_cfg_value "hour"`
local week=`get_cfg_value "week"`
local sday=`get_cfg_value "sday"`
local once=`get_cfg_value "once"`
if [ $minute = 0 ] ; then
minute="00"
fi
if [ $week != 8 ] ; then
sday="*"
else
sday=`echo $sday | grep -owE "^[0-9]+\-[0-9]+|^[0-9]+(,[0-9]+)*"`
[ -z $sday ] && sday=15
fi
if [ $week -gt 6 ] ; then
week="*"
fi
renable=`get_cfg_value "enable"`
param=`get_cron_parameter`
cfgstr="$minute $hour $sday * $week"
cronstr=`get_cron_timestr`
if [ "$renable" == "0" ]; then
clear_cron
echo "Timed Reboot has been cleared." > /tmp/timedreboot.log
elif [ "$cfgstr" == "$cronstr" ]; then
if [ -z "$param" ]; then
echo "1"
set_cron "$cfgstr" "$once"
elif [ "$param" != "$once" ]; then
echo "2"
set_cron "$cfgstr" "$once"
else
echo "3"
echo "Timed Reboot is set." > /tmp/timedreboot.log
exit 0
fi
else
echo "4"
set_cron "$cfgstr" "$once"
fi
}
# ------------main-------------
renable=`get_cfg_value "enable"`
if [ "$renable" != "0" ]; then
/etc/init.d/timedreboot enable
fi
if [ "${1}" = "0" -o "${1}" = "1" ]; then
rebootsys
else
justcfg
sleep 10s
justcfg
fi
exit 0
@@ -1,14 +0,0 @@
{
"luci-app-timedreboot": {
"description": "Grant UCI access for luci-app-timedreboot",
"read": {
"file": {
"/etc/init.d/timedreboot": [ "exec" ]
},
"uci": [ "timedreboot" ]
},
"write": {
"uci": [ "timedreboot" ]
}
}
}