├── luci-app-taskplan ├── root │ ├── etc │ │ ├── taskplan │ │ │ ├── taskplancustomscript │ │ │ ├── taskplancustomscript2 │ │ │ └── taskplanrun │ │ ├── uci-defaults │ │ │ └── luci-taskplan │ │ ├── config │ │ │ └── taskplan │ │ └── init.d │ │ │ └── taskplan │ └── usr │ │ ├── share │ │ └── rpcd │ │ │ └── acl.d │ │ │ └── luci-app-taskplan.json │ │ └── bin │ │ └── taskplanhandler ├── luasrc │ ├── model │ │ └── cbi │ │ │ └── taskplan │ │ │ ├── log.lua │ │ │ ├── startuptask.lua │ │ │ └── scheduledtask.lua │ ├── controller │ │ └── taskplan.lua │ └── view │ │ └── taskplan │ │ └── log.htm ├── Makefile └── po │ ├── zh-cn │ └── taskplan.po │ └── zh_Hans │ └── taskplan.po ├── doc ├── view.png ├── view2.png ├── taskplan1.png ├── taskplan2.png └── taskplan3.png ├── LICENSE ├── .github └── workflows │ └── main.yml ├── README_CN.md └── README.md /luci-app-taskplan/root/etc/taskplan/taskplancustomscript: -------------------------------------------------------------------------------- 1 | # Sh script rules 2 | -------------------------------------------------------------------------------- /luci-app-taskplan/root/etc/taskplan/taskplancustomscript2: -------------------------------------------------------------------------------- 1 | # Sh script2 rules -------------------------------------------------------------------------------- /doc/view.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sirpdboy/luci-app-taskplan/HEAD/doc/view.png -------------------------------------------------------------------------------- /doc/view2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sirpdboy/luci-app-taskplan/HEAD/doc/view2.png -------------------------------------------------------------------------------- /luci-app-taskplan/root/etc/taskplan/taskplanrun: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo "" 4 | exit 0 -------------------------------------------------------------------------------- /doc/taskplan1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sirpdboy/luci-app-taskplan/HEAD/doc/taskplan1.png -------------------------------------------------------------------------------- /doc/taskplan2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sirpdboy/luci-app-taskplan/HEAD/doc/taskplan2.png -------------------------------------------------------------------------------- /doc/taskplan3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sirpdboy/luci-app-taskplan/HEAD/doc/taskplan3.png -------------------------------------------------------------------------------- /luci-app-taskplan/root/usr/share/rpcd/acl.d/luci-app-taskplan.json: -------------------------------------------------------------------------------- 1 | { 2 | "luci-app-taskplan": { 3 | "description": "Grant UCI access for luci-app-taskplan", 4 | "read": { 5 | "uci": [ "taskplan" ] 6 | }, 7 | "write": { 8 | "uci": [ "taskplan" ] 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /luci-app-taskplan/luasrc/model/cbi/taskplan/log.lua: -------------------------------------------------------------------------------- 1 | local fs = require "nixio.fs" 2 | local uci = require"luci.model.uci".cursor() 3 | local f, t 4 | f = SimpleForm("logview") 5 | f.reset = false 6 | f.submit = false 7 | t=f:field(TextValue,"conf") 8 | 9 | t.rmempty=true 10 | t.rows=20 11 | t.template="taskplan/log" 12 | t.readonly="readonly" 13 | return f 14 | -------------------------------------------------------------------------------- /luci-app-taskplan/root/etc/uci-defaults/luci-taskplan: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | chmod +x /etc/init.d/taskplan /usr/bin/taskplanhandler /etc/init.d/taskplanrun 3 | uci -q batch <<-EOF >/dev/null 4 | delete ucitrack.@taskplan[-1] 5 | add ucitrack taskplan 6 | set ucitrack.@taskplan[-1].init="taskplan" 7 | commit ucitrack 8 | EOF 9 | rm -rf /tmp/luci-modulecache /tmp/luci-indexcache* 10 | exit 0 -------------------------------------------------------------------------------- /luci-app-taskplan/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2019-2025 sirpdboy 3 | # 4 | # This is free software, licensed under the Apache License, Version 2.0 . 5 | # 6 | 7 | include $(TOPDIR)/rules.mk 8 | 9 | NAME:=taskplan 10 | PKG_NAME:=luci-app-$(NAME) 11 | LUCI_TITLE:=LuCI support for Task Plan setting 12 | LUCI_PKGARCH:=all 13 | 14 | PKG_VERSION:=2.3.1 15 | PKG_RELEASE:=20251023 16 | 17 | 18 | define Package/$(PKG_NAME)/conffiles 19 | /etc/config/taskplan 20 | endef 21 | 22 | include $(TOPDIR)/feeds/luci/luci.mk 23 | 24 | # call BuildPackage - OpenWrt buildroot signature 25 | 26 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019-2020 johnrosen1 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /.github/workflows/main.yml: -------------------------------------------------------------------------------- 1 | name: Build 2 | 3 | on: 4 | push: 5 | tags: 6 | - v* 7 | 8 | jobs: 9 | build: 10 | name: Build ${{ matrix.arch }} 11 | runs-on: ubuntu-latest 12 | strategy: 13 | fail-fast: false 14 | matrix: 15 | arch: 16 | - aarch64_generic 17 | - i386_pentium-mmx 18 | - loongarch64_generic 19 | - mips_mips32 20 | - mipsel_24kc 21 | - mipsel_mips32 22 | - x86_64 23 | steps: 24 | - uses: actions/checkout@main 25 | with: 26 | fetch-depth: 0 27 | - name: Building packages 28 | uses: sbwml/openwrt-gh-action-sdk@go1.24 29 | env: 30 | ARCH: ${{ matrix.arch }}-openwrt-24.10 31 | FEEDNAME: packages_ci 32 | PACKAGES: luci-app-autotimeset 33 | NO_REFRESH_CHECK: true 34 | 35 | - name: Upload artifacts 36 | uses: actions/upload-artifact@v4 37 | with: 38 | name: ${{ matrix.arch }} 39 | path: bin/packages/${{ matrix.arch }}/packages_ci/*.ipk 40 | 41 | - name: Upload packages 42 | uses: ncipollo/release-action@v1 43 | with: 44 | token: ${{ secrets.GITHUB_TOKEN }} 45 | allowUpdates: true 46 | replacesArtifacts: true 47 | artifacts: "bin/packages/${{ matrix.arch }}/packages_ci/*.ipk" 48 | -------------------------------------------------------------------------------- /luci-app-taskplan/luasrc/controller/taskplan.lua: -------------------------------------------------------------------------------- 1 | module("luci.controller.taskplan",package.seeall) 2 | local fs=require"nixio.fs" 3 | local http=require"luci.http" 4 | function index() 5 | if not nixio.fs.access("/etc/config/taskplan") then 6 | return 7 | end 8 | entry({"admin", "control"}, firstchild(), "Control", 44).dependent = false 9 | local e = entry({"admin", "control", "taskplan"}, alias("admin", "control", "taskplan", "scheduledtask"), _("Task Plan"), 20) 10 | e.dependent = false 11 | e.acl_depends = { "luci-app-taskplan" } 12 | entry({"admin", "control", "taskplan", "scheduledtask"}, cbi("taskplan/scheduledtask"), _("Scheduled task"), 10).leaf = true 13 | entry({"admin", "control", "taskplan", "startuptask"}, cbi("taskplan/startuptask"), _("Startup task"), 20).leaf = true 14 | entry({"admin", "control", "taskplan", "log"}, form("taskplan/log"), _("Log"), 30).leaf = true 15 | entry({"admin","control","taskplan","dellog"},call("dellog")) 16 | entry({"admin","control","taskplan","getlog"},call("getlog")) 17 | end 18 | 19 | function getlog() 20 | logfile="/etc/taskplan/taskplan.log" 21 | if not fs.access(logfile) then 22 | http.write("") 23 | return 24 | end 25 | local f=io.open(logfile,"r") 26 | local a=f:read("*a") or "" 27 | f:close() 28 | a=string.gsub(a,"\n$","") 29 | http.prepare_content("text/plain; charset=utf-8") 30 | http.write(a) 31 | end 32 | 33 | function dellog() 34 | fs.writefile("/etc/taskplan/taskplan.log","") 35 | http.prepare_content("application/json") 36 | http.write('') 37 | end 38 | -------------------------------------------------------------------------------- /luci-app-taskplan/root/etc/config/taskplan: -------------------------------------------------------------------------------- 1 | 2 | config global 3 | option enabled '0' 4 | option customscript '# Sh script rules' 5 | option customscript2 '# Sh script rules' 6 | 7 | config stime 8 | option hour '*/4' 9 | option stype '7' 10 | option week '*' 11 | option minute '0' 12 | option month '*' 13 | option enable '0' 14 | option ttype '0' 15 | option delay '10' 16 | option remarks '每月每天每过4小时执行一次' 17 | 18 | config stime 19 | option minute '0' 20 | option month '*' 21 | option enable '0' 22 | option delay '10' 23 | option stype '1' 24 | option ttype '0' 25 | option hour '1' 26 | option remarks '每月星期日1:00执行' 27 | option week '0' 28 | 29 | config stime 30 | option week '*' 31 | option month '*' 32 | option enable '0' 33 | option ttype '0' 34 | option delay '10' 35 | option stype '10' 36 | option minute '*/5' 37 | option hour '*' 38 | option remarks '每月每天每过5分钟执行' 39 | 40 | config stime 41 | option week '*' 42 | option stype '2' 43 | option month '*' 44 | option enable '0' 45 | option ttype '0' 46 | option delay '10' 47 | option remarks '每天22:30执行' 48 | option hour '22' 49 | option minute '30' 50 | 51 | config stime 52 | option minute '0' 53 | option enable '0' 54 | option ttype '0' 55 | option delay '10' 56 | option stype '6' 57 | option remarks '7月星期一到星期五22:00执行' 58 | option month '7' 59 | option week '1-5' 60 | option hour '22' 61 | 62 | config stime 63 | option week '*' 64 | option month '*' 65 | option stype '11' 66 | option ttype '1' 67 | option delay '20' 68 | option enable '0' 69 | option hour '*' 70 | option remarks '每月每天每过4分钟执行' 71 | option minute '*/4' 72 | 73 | config ltime 74 | option remarks '开机启动延时30秒执行' 75 | option stype '11' 76 | option delay '30' 77 | option enable '0' 78 | 79 | -------------------------------------------------------------------------------- /luci-app-taskplan/luasrc/view/taskplan/log.htm: -------------------------------------------------------------------------------- 1 | <%+cbi/valueheader%> 2 | 3 | <%:Reverse%> 4 | 5 | 6 | 54 | <%+cbi/valuefooter%> -------------------------------------------------------------------------------- /luci-app-taskplan/luasrc/model/cbi/taskplan/startuptask.lua: -------------------------------------------------------------------------------- 1 | 2 | local m,s,e 3 | 4 | m=Map("taskplan",translate("Startup task"),translate("The original [Timing Settings] includes scheduled task execution and startup task execution. Presets include over 10 functions, including restart, shutdown, network restart, memory release, system cleaning, network sharing, network shutdown, automatic detection of network disconnects and reconnection, MWAN3 load balancing detection of reconnection, and custom scripts") .. 5 | translate("The task to be executed upon startup, with a startup delay time unit of seconds.")) 6 | 7 | s = m:section(TypedSection, 'global') 8 | s.anonymous=true 9 | 10 | e=s:option(TextValue, "customscript" ,translate("Edit Custom Script")) 11 | e.description = translate("The execution content of the [Scheduled Customscript] in the task name") 12 | e.rows = 5 13 | e.default=" " 14 | 15 | e=s:option(TextValue, "customscript2" ,translate("Edit Custom Script2")) 16 | e.description = translate("The execution content of the [Scheduled Customscript2] in the task name") 17 | e.rows = 5 18 | e.default=" " 19 | 20 | s=m:section(TypedSection,"ltime","") 21 | s.addremove=true 22 | s.anonymous=true 23 | s.template = "cbi/tblsection" 24 | 25 | e = s:option(Value, 'remarks', translate('Remarks')) 26 | 27 | e=s:option(Flag,"enable",translate("Enable")) 28 | e.rmempty = false 29 | e.default=0 30 | 31 | e=s:option(ListValue,"stype",translate("Scheduled Type")) 32 | e:value(1,translate("Scheduled Reboot")) 33 | e:value(2,translate("Scheduled Poweroff")) 34 | e:value(3,translate("Scheduled ReNetwork")) 35 | e:value(4,translate("Scheduled RestartSamba")) 36 | e:value(5,translate("Scheduled Restartwan")) 37 | e:value(6,translate("Scheduled Closewan")) 38 | e:value(7,translate("Scheduled Clearmem")) 39 | e:value(8,translate("Scheduled Sysfree")) 40 | e:value(9,translate("Scheduled DisReconn")) 41 | e:value(10,translate("Scheduled DisRereboot")) 42 | e:value(11,translate("Scheduled Restartmwan3")) 43 | e:value(13,translate("Scheduled Wifiup")) 44 | e:value(14,translate("Scheduled Wifidown")) 45 | e:value(12,translate("Scheduled Customscript")) 46 | e:value(15,translate("Scheduled Customscript2")) 47 | e.default=2 48 | 49 | e=s:option(Value,"delay",translate("Delayed Start(seconds)")) 50 | e.default=10 51 | 52 | m.apply_on_parse = true 53 | m.on_after_apply = function(self,map) 54 | luci.sys.exec("/etc/init.d/taskplan start") 55 | end 56 | 57 | return m 58 | -------------------------------------------------------------------------------- /luci-app-taskplan/po/zh-cn/taskplan.po: -------------------------------------------------------------------------------- 1 | 2 | msgid "The original [Timing Settings] includes scheduled task execution and startup task execution. Presets include over 10 functions, including restart, shutdown, network restart, memory release, system cleaning, network sharing, network shutdown, automatic detection of network disconnects and reconnection, MWAN3 load balancing detection of reconnection, and custom scripts" 3 | msgstr "任务计划包括定时任务执行和开机启动任务执行,预置:重启、关机、重启网络、释放内存、系统清理、网络共享、关闭网络、自动检测断网重连、自动检测断网重启、MWAN3负载均衡检测重连、自定义脚本等10多个功能." 4 | 5 | msgid "N1-N5 is continuous, N1, N3, N5 is discontinuous, */N represents every N hours or every N minutes.The week can only be 0~6, the hour can only be 0~23, the minute can only be 0~59, the unavailable time is 48 hours." 6 | msgstr "N1-N5连续,N1,N3,N5不连续,*/N表示每N小时或每N分钟。月份范围0-11,星期范围0~6,小时范围0~23,分钟范围0~59,不可用72小时或者90分钟等连续范围。" 7 | 8 | msgid "Scheduled task" 9 | msgstr "定时执行任务" 10 | 11 | msgid "Startup task" 12 | msgstr "开机启动任务" 13 | 14 | msgid "The task to be executed upon startup, with a startup delay time unit of seconds." 15 | msgstr "开机启动执行的任务,启动延时时间单位为秒。" 16 | 17 | msgid "Control" 18 | msgstr "管控" 19 | 20 | msgid "Task Plan" 21 | msgstr "任务设置" 22 | 23 | msgid "Test/Verify Settings" 24 | msgstr "测试/验证设置" 25 | 26 | msgid "Scheduled Type" 27 | msgstr "任务类型" 28 | 29 | msgid "Delayed Start(seconds)" 30 | msgstr "开机任务延时(秒)" 31 | 32 | msgid "Log" 33 | msgstr "日志" 34 | 35 | msgid "Scheduled Reboot" 36 | msgstr "重启机器" 37 | 38 | msgid "Scheduled Poweroff" 39 | msgstr "关闭机器" 40 | 41 | msgid "Scheduled ReNetwork" 42 | msgstr "重启网络" 43 | 44 | msgid "Scheduled RestartSamba" 45 | msgstr "重启网络共享" 46 | 47 | msgid "Scheduled Restartlan" 48 | msgstr "重启LAN" 49 | 50 | msgid "Scheduled Restartwan" 51 | msgstr "重启WAN" 52 | 53 | msgid "Scheduled Closewan" 54 | msgstr "关闭网络" 55 | 56 | msgid "Scheduled Clearmem" 57 | msgstr "释放内存" 58 | 59 | msgid "Scheduled Sysfree" 60 | msgstr "系统清理(会重启机器)" 61 | 62 | msgid "Scheduled DisReconn" 63 | msgstr "检测断网重连" 64 | 65 | msgid "Scheduled DisRereboot" 66 | msgstr "检测断网重启" 67 | 68 | msgid "Scheduled Restartmwan3" 69 | msgstr "检测MWAN3失联重启服务" 70 | 71 | msgid "Scheduled Wifidown" 72 | msgstr "关闭无线网络" 73 | 74 | msgid "Scheduled Wifiup" 75 | msgstr "启用无线网络" 76 | 77 | msgid "Edit Custom Script" 78 | msgstr "【自定义脚本】编辑" 79 | 80 | msgid "Edit Custom Script2" 81 | msgstr "【自定义脚本2】编辑" 82 | 83 | msgid "Scheduled Customscript" 84 | msgstr "自定义脚本" 85 | 86 | msgid "Scheduled Customscript2" 87 | msgstr "自定义脚本2" 88 | 89 | msgid "The execution content of the [Scheduled Customscript] in the task name" 90 | msgstr "任务名称中【自定义脚本】执行内容" 91 | 92 | msgid "The execution content of the [Scheduled Customscript2] in the task name" 93 | msgstr "任务名称中【自定义脚本2】执行内容" 94 | 95 | msgid "Month(0~11)" 96 | msgstr "月份(0~11)" 97 | 98 | msgid "Week Day(0~6)" 99 | msgstr "星期(0~6)" 100 | 101 | msgid "Everyday" 102 | msgstr "每天" 103 | 104 | msgid "Hour(0~23)" 105 | msgstr "小时(0~23)" 106 | 107 | msgid "Minute(0~59)" 108 | msgstr "分钟(0~59)" 109 | 110 | -------------------------------------------------------------------------------- /luci-app-taskplan/po/zh_Hans/taskplan.po: -------------------------------------------------------------------------------- 1 | 2 | msgid "The original [Timing Settings] includes scheduled task execution and startup task execution. Presets include over 10 functions, including restart, shutdown, network restart, memory release, system cleaning, network sharing, network shutdown, automatic detection of network disconnects and reconnection, MWAN3 load balancing detection of reconnection, and custom scripts" 3 | msgstr "任务计划包括定时任务执行和开机启动任务执行,预置:重启、关机、重启网络、释放内存、系统清理、网络共享、关闭网络、自动检测断网重连、自动检测断网重启、MWAN3负载均衡检测重连、自定义脚本等10多个功能." 4 | 5 | msgid "N1-N5 is continuous, N1, N3, N5 is discontinuous, */N represents every N hours or every N minutes.The week can only be 0~6, the hour can only be 0~23, the minute can only be 0~59, the unavailable time is 48 hours." 6 | msgstr "N1-N5连续,N1,N3,N5不连续,*/N表示每N小时或每N分钟。月份范围0-11,星期范围0~6,小时范围0~23,分钟范围0~59,不可用72小时或者90分钟等连续范围。" 7 | 8 | msgid "Scheduled task" 9 | msgstr "定时执行任务" 10 | 11 | msgid "Startup task" 12 | msgstr "开机启动任务" 13 | 14 | msgid "The task to be executed upon startup, with a startup delay time unit of seconds." 15 | msgstr "开机启动执行的任务,启动延时时间单位为秒。" 16 | 17 | msgid "Control" 18 | msgstr "管控" 19 | 20 | msgid "Task Plan" 21 | msgstr "任务设置" 22 | 23 | msgid "Test/Verify Settings" 24 | msgstr "测试/验证设置" 25 | 26 | msgid "Scheduled Type" 27 | msgstr "任务类型" 28 | 29 | msgid "Delayed Start(seconds)" 30 | msgstr "开机任务延时(秒)" 31 | 32 | msgid "Log" 33 | msgstr "日志" 34 | 35 | msgid "Scheduled Reboot" 36 | msgstr "重启机器" 37 | 38 | msgid "Scheduled Poweroff" 39 | msgstr "关闭机器" 40 | 41 | msgid "Scheduled ReNetwork" 42 | msgstr "重启网络" 43 | 44 | msgid "Scheduled RestartSamba" 45 | msgstr "重启网络共享" 46 | 47 | msgid "Scheduled Restartlan" 48 | msgstr "重启LAN" 49 | 50 | msgid "Scheduled Restartwan" 51 | msgstr "重启WAN" 52 | 53 | msgid "Scheduled Closewan" 54 | msgstr "关闭网络" 55 | 56 | msgid "Scheduled Clearmem" 57 | msgstr "释放内存" 58 | 59 | msgid "Scheduled Sysfree" 60 | msgstr "系统清理(会重启机器)" 61 | 62 | msgid "Scheduled DisReconn" 63 | msgstr "检测断网重连" 64 | 65 | msgid "Scheduled DisRereboot" 66 | msgstr "检测断网重启" 67 | 68 | msgid "Scheduled Restartmwan3" 69 | msgstr "检测MWAN3失联重启服务" 70 | 71 | msgid "Scheduled Wifidown" 72 | msgstr "关闭无线网络" 73 | 74 | msgid "Scheduled Wifiup" 75 | msgstr "启用无线网络" 76 | 77 | msgid "Edit Custom Script" 78 | msgstr "【自定义脚本】编辑" 79 | 80 | msgid "Edit Custom Script2" 81 | msgstr "【自定义脚本2】编辑" 82 | 83 | msgid "Scheduled Customscript" 84 | msgstr "自定义脚本" 85 | 86 | msgid "Scheduled Customscript2" 87 | msgstr "自定义脚本2" 88 | 89 | msgid "The execution content of the [Scheduled Customscript] in the task name" 90 | msgstr "任务名称中【自定义脚本】执行内容" 91 | 92 | msgid "The execution content of the [Scheduled Customscript2] in the task name" 93 | msgstr "任务名称中【自定义脚本2】执行内容" 94 | 95 | msgid "Month(0~11)" 96 | msgstr "月份(0~11)" 97 | 98 | msgid "Week Day(0~6)" 99 | msgstr "星期(0~6)" 100 | 101 | msgid "Everyday" 102 | msgstr "每天" 103 | 104 | msgid "Hour(0~23)" 105 | msgstr "小时(0~23)" 106 | 107 | msgid "Minute(0~59)" 108 | msgstr "分钟(0~59)" 109 | 110 | -------------------------------------------------------------------------------- /luci-app-taskplan/luasrc/model/cbi/taskplan/scheduledtask.lua: -------------------------------------------------------------------------------- 1 | 2 | local m,s,e 3 | 4 | m=Map("taskplan",translate("Scheduled task"),translate("The original [Timing Settings] includes scheduled task execution and startup task execution. Presets include over 10 functions, including restart, shutdown, network restart, memory release, system cleaning, network sharing, network shutdown, automatic detection of network disconnects and reconnection, MWAN3 load balancing detection of reconnection, and custom scripts") .. 5 | translate("N1-N5 is continuous, N1, N3, N5 is discontinuous, */N represents every N hours or every N minutes.The week can only be 0~6, the hour can only be 0~23, the minute can only be 0~59, the unavailable time is 48 hours.")) 6 | 7 | s = m:section(TypedSection, 'global') 8 | s.anonymous=true 9 | 10 | e=s:option(TextValue, "customscript" ,translate("Edit Custom Script")) 11 | e.description = translate("The execution content of the [Scheduled Customscript] in the task name") 12 | e.rows = 5 13 | e.default=" " 14 | 15 | e=s:option(TextValue, "customscript2" ,translate("Edit Custom Script2")) 16 | e.description = translate("The execution content of the [Scheduled Customscript2] in the task name") 17 | e.rows = 5 18 | e.default=" " 19 | 20 | s=m:section(TypedSection,"stime","") 21 | s.addremove=true 22 | s.anonymous=true 23 | s.template = "cbi/tblsection" 24 | 25 | e = s:option(Value, 'remarks', translate('Remarks')) 26 | 27 | e=s:option(Flag,"enable",translate("Enable")) 28 | e.rmempty = false 29 | e.default=0 30 | 31 | e=s:option(ListValue,"stype",translate("Scheduled Type")) 32 | e:value(1,translate("Scheduled Reboot")) 33 | e:value(2,translate("Scheduled Poweroff")) 34 | e:value(3,translate("Scheduled ReNetwork")) 35 | e:value(4,translate("Scheduled RestartSamba")) 36 | e:value(5,translate("Scheduled Restartwan")) 37 | e:value(6,translate("Scheduled Closewan")) 38 | e:value(7,translate("Scheduled Clearmem")) 39 | e:value(8,translate("Scheduled Sysfree")) 40 | e:value(9,translate("Scheduled DisReconn")) 41 | e:value(10,translate("Scheduled DisRereboot")) 42 | e:value(11,translate("Scheduled Restartmwan3")) 43 | e:value(13,translate("Scheduled Wifiup")) 44 | e:value(14,translate("Scheduled Wifidown")) 45 | e:value(12,translate("Scheduled Customscript")) 46 | e:value(15,translate("Scheduled Customscript2")) 47 | e.default=2 48 | 49 | 50 | e=s:option(Value,"month",translate("Month(0~11)")) 51 | e.rmempty = false 52 | e.default = '*' 53 | 54 | week=s:option(Value,"week",translate("Week Day(0~6)")) 55 | week.rmempty = true 56 | week:value('*',translate("Everyday")) 57 | week:value(0,translate("Sunday")) 58 | week:value(1,translate("Monday")) 59 | week:value(2,translate("Tuesday")) 60 | week:value(3,translate("Wednesday")) 61 | week:value(4,translate("Thursday")) 62 | week:value(5,translate("Friday")) 63 | week:value(6,translate("Saturday")) 64 | week.default='*' 65 | 66 | e=s:option(Value,"hour",translate("Hour(0~23)")) 67 | e.rmempty = false 68 | e.default = 0 69 | 70 | e=s:option(Value,"minute",translate("Minute(0~59)")) 71 | e.rmempty = false 72 | e.default = 0 73 | 74 | m.apply_on_parse = true 75 | m.on_after_apply = function(self,map) 76 | luci.sys.exec("/etc/init.d/taskplan start") 77 | end 78 | 79 | return m 80 | -------------------------------------------------------------------------------- /luci-app-taskplan/root/usr/bin/taskplanhandler: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # author 2021 jjm2473 3 | # author 2020-2024 sirpdboy 4 | TMP_T=/var/taskplan/taskplan.tmp 5 | LOG=/etc/taskplan/taskplan.log 6 | log(){ 7 | echo "$(date +'%Y-%m-%d %H:%M:%S') $*" >> $LOG 8 | } 9 | 10 | limit_log() { 11 | local logf=$1 12 | [ ! -f "$logf" ] && return 13 | local sc=100 14 | [ -n "$2" ] && sc=$2 15 | local count=$(grep -c "" $logf) 16 | if [ $count -gt $sc ];then 17 | let count=count-$sc 18 | sed -i "1,$count d" $logf 19 | fi 20 | } 21 | 22 | remwan3() { 23 | while true; do 24 | status=$(/usr/sbin/mwan3 status | grep error) 25 | if [ -z $status ]; then 26 | log "Mwan3 is OK" 27 | exit 1 28 | else 29 | log "mwan3 restarting ..." 30 | /usr/sbin/mwan3 restart 31 | fi 32 | sleep 60 33 | done 34 | } 35 | 36 | disreconnwan() { 37 | i=0 38 | PingA=114.114.114.114 39 | PingB=223.5.5.5 40 | while [[ $i -lt 5 ]] 41 | do 42 | if /bin/ping -c 1 $PingA >/dev/null 43 | then 44 | PingErr=0 45 | break 46 | else 47 | if /bin/ping -c 1 $PingB >/dev/null 48 | then 49 | PingErr=0 50 | break 51 | else 52 | i=$(($i + 1)) 53 | PingErr=1 54 | sleep 10 55 | fi 56 | fi 57 | done 58 | } 59 | 60 | trigger() { 61 | case "$1" in 62 | reboot) 63 | reboot 64 | ;; 65 | poweroff) 66 | poweroff 67 | ;; 68 | network) 69 | /etc/init.d/network restart 70 | ;; 71 | clearmem) 72 | sync && echo 3 > /proc/sys/vm/drop_caches 73 | ;; 74 | sysfree) 75 | cd /overlay 76 | rm -rf `ls | egrep -v '(upper|.fs_state)'` 77 | cd upper 78 | rm -rf `ls | egrep -v '(etc)'` 79 | cd etc 80 | rm -rf `ls | egrep -v '(config|ssr|bench.log|shadow)'` 81 | rm -rf /var/luci-modulecache 82 | rm -rf /var/luci-indexcache 83 | rm -rf /tmp/cache/* 84 | reboot 85 | ;; 86 | restartsamba) 87 | /etc/init.d/ksmdb restart 88 | /etc/init.d/samba restart 89 | /etc/init.d/samba4 restart 90 | ;; 91 | 92 | restartlan) 93 | ifdown lan && ifup lan 94 | log "restart lan succeeded!" 95 | ;; 96 | restartwan) 97 | ifup wan 98 | log "restart wan succeeded!" 99 | ;; 100 | closewan) 101 | ifdown wan 102 | ;; 103 | disreconn) 104 | disreconnwan 105 | if [ $PingErr = 1 ]; then 106 | ifup wan 107 | log "Redial succeeded!" 108 | fi 109 | ;; 110 | disrereboot) 111 | disreconnwan 112 | if [ $PingErr = 1 ]; then 113 | log "Reboot succeeded!" 114 | reboot 115 | fi 116 | ;; 117 | restartmwan3) 118 | [ -s /usr/sbin/mwan3 ] && remwan3 119 | ;; 120 | customscript) 121 | script=`cat /etc/taskplan/taskplancustomscript | wc -l` 122 | if [[ $script > 0 ]] ;then 123 | bash /etc/taskplan/taskplancustomscript 124 | log "CustomScript succeeded!" 125 | else 126 | log "CustomScript run Error!" 127 | fi 128 | ;; 129 | customscript2) 130 | script=`cat /etc/taskplan/taskplancustomscript2 | wc -l` 131 | if [[ $script > 0 ]] ;then 132 | bash /etc/taskplan/taskplancustomscript2 133 | log "CustomScript2 succeeded!" 134 | else 135 | log "CustomScript2 run Error!" 136 | fi 137 | ;; 138 | upwifi) 139 | ifconfig wlan0 up 140 | uci set wireless.radio0.disabled=0 141 | uci set wireless.radio1.disabled=0 142 | uci commit wireless 143 | wifi up 144 | ;; 145 | downwifi) 146 | ifconfig wlan0 down 147 | uci set wireless.radio0.disabled=1 148 | uci set wireless.radio1.disabled=1 149 | uci commit wireless 150 | wifi down 151 | ;; 152 | esac 153 | } 154 | 155 | limit_log $LOG 500 156 | PingErr=0 157 | log "Scheduled operation $2: $1" && trigger $1 158 | 159 | -------------------------------------------------------------------------------- /README_CN.md: -------------------------------------------------------------------------------- 1 | ## 访问数:[](https://t.me/joinchat/AAAAAEpRF88NfOK5vBXGBQ) 2 | 3 |
8 |
9 |
10 |
11 |
12 |
8 |
9 |
10 |
11 |
12 |