uweb updates to 1055
[uweb.git] / zh / tcron / index.html
blobd9414f043df40ce866b37b4d77d8659863643b25
1 <!doctype html>
2 <html>
3 <head>
4 <meta charset="utf-8">
5 <meta name="viewport" content="width=device-width, initial-scale=1" />
7 <link rel="stylesheet" href="../style.css#" type="text/css" />
8 <title>定时脚本</title>
9 <script type="text/javascript">
10 function findLang(){
11 let href = location.href;
12 for(let i=href.length-1;i>0;i--){
13 if('/'==href.charAt(i) && '/'==href.charAt(i-3))
14 return i;
16 return 0;
18 function nav2(page){
19 let i = findLang();
20 location.href = location.href.substring(0,i+1)+page;
22 function nav2Lang(lang){
23 let i = findLang();
24 let href = location.href;
25 location.href = location.href.substring(0,i-2)+lang+location.href.substring(i);
27 </script>
28 </head>
29 <body>
30 <header class='header'>
31 <a class="logo" href="javascript:void(0)" onclick="return nav2('index.html#')">Home</a> <a class="logo" href="javascript:void(0)" onclick="return nav2('tags/index.html#')">Tags</a>
34 <a class="logo" href="javascript:void(0)" onclick="return nav2Lang('en')">English</a>
37 <nav>
38 </nav>
39 </header>
40 <br />
42 <div class="container">
43 <h1 class="title">定时脚本
44 <br>
45 <span class="subtitle"></span>
46 </h1>
47 <ul class="tags">
49 </ul>
50 <h4 id="crontab">crontab</h4>
51 <p>注意:1. 必须使用单一空格作为分割符。<br>
52 2. 必须同时满足日期及星期的要求(功能增强),crontab标准只要求满足其中一个要求。</p>
53 <p>文件&quot;crontab&quot;每行第六部分可为url或<a href="../links/index.html#">内部链接</a>,也可为&quot;c:&quot;通知termux执行后面命令; &quot;!&quot;直接执行命令。其余格式一律作为闹钟提醒时的伴随消息。</p>
54 <p>文件&quot;crontab&quot;自动签到例子:<br>
55 5 8,9 * * * i:p1http://m.bookschina.com/ActityDaily/AvSignIn<br>
56 7 9 * * * i:p1http://m.bookschina.com/ActityDaily/AvSignInTakeQuan<br>
57 6 9 * * * i:p1http://m.bookschina.com/UserCenter/SignInApi#action=SignIn<br>
58 8 9 * * * i:p1http://m.bookschina.com/UserCenter/SignInAward#index=1</p>
59 <p>其中&quot;i:a1&quot;为对url发起&quot;post&quot;请求。</p>
60 <h4 id="tcron">tcron</h4>
61 <p>如果勾选“文件预处理”,则uweb启动时运行&quot;default.rc&quot; shell脚本。可与tcron定时管<br>
62 理工具(<a href="i:0bhttps://fastly.jsdelivr.net/gh/torappinfo/uwebjs/bin/tcron.tgz">安装tcron</a>)配合运行定时任务,如存储清理、网页签到等。</p>
63 <p>勾选“文件预处理”的情况下,如果存在文件&quot;default.rc2&quot;,则在超微浏览器成为前台时,此文件代码被执行。在超微永不退出的情况下,&quot;default.rc&quot;将没有任何执行机会,而&quot;default.rc2&quot;保证即使超微长时间不重启,定时脚本仍可以执行。</p>
64 <p>usage: tcron logfile command hours [timezone delay_sec elsecommand]<br>
65 指定时间范围内如果命令没有被执行过,则tcron会执行一次命令。<br>
66 其中logfile可以不记录任何log,成功执行命令以后只需更新一下改动时间即可。<br>
67 hours: 如果为正整数,则将每天划分为不同的时间区间(单位小时),每个区间命令只能执行一次。如果为负整数,则取绝对值,并且单位为分钟,保证下一次执行至少间隔这么多分钟。<br>
68 hours也可以为&quot;hh:mm-hh:mm,...&quot;格式, 譬如&quot;6:00-8:30,11:00-13:00,5:30-6:30&quot;为每天三餐时间脚本执行一次。<br>
69 timezone: 时区:譬如“8”表示北京时间。(默认为8)<br>
70 delay_sec: 等待指定秒数后再执行命令,防止命令被集中执行。<br>
71 elsecommand: 无需执行命令command时执行。</p>
72 <p>ex:<br>
73 set PATH=/system/bin:/data/data/info.torapp.uweb/files/bin<br>
74 #天翼云每天签到一次<br>
75 tcron /sdcard/a &quot;cloudpan189-go sign;toybox touch /sdcard/a&quot; 24<br>
76 #每30天清空baidu目录<br>
77 tcron /sdcard/b &quot;rm -rf /sdcard/baidu/*;toybox touch /sdcard/b&quot; 720</p>
78 <p><a target="_self" href="i:0hdefault.rc:../searchurl/txt/default.rc">安装default.rc模板文件(termux)</a></p>
79 <p>可能用到的命令:<br>
80 termux中安装remind,可配置各类提醒功能,十分强大。<br>
81 apt install remind</p>
82 <p>am start -n info.torapp.uweb/.wvActivity -d 'javascript:alert(&quot;remind&quot;)' #提醒<br>
83 其中-d后面参数可以为任意url包括超微内部&quot;i:&quot; url。</p>
85 </div>
86 <p>Last Modified: 29 August 2024<br>
87 change i:a to be i:p to indicate Post<br>
88 <pre></pre>
89 </p>
91 <script id='jsgiscus'
92 src='https://giscus.app/client.js'
93 data-repo="torappinfo/uweb"
94 data-repo-id="MDEwOlJlcG9zaXRvcnkzMDIyMDU3MjE="
95 data-category="Announcements"
96 data-category-id="DIC_kwDOEgNLGc4CQjsh"
97 data-mapping="title"
98 data-strict="0"
99 data-reactions-enabled="1"
100 data-emit-metadata="0"
101 data-input-position="top"
102 data-theme="light"
103 data-lang="en"
104 data-loading="lazy"
105 crossorigin="anonymous" async>
106 </script>
108 <footer class="site-footer">
109 <div class="container">
110 &copy; 2018-2024 Richard H. Cao
111 </div>
112 </footer>
113 <!-- This document is licensed under the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is available at <https://www.gnu.org/licenses/>. -->
116 </body>
117 </html>