2020-11-24 13:24:22 +00:00
|
|
|
|
<!doctype html>
|
|
|
|
|
<html>
|
|
|
|
|
<head>
|
|
|
|
|
<meta charset="utf-8">
|
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
|
|
|
|
2022-10-31 07:28:14 +00:00
|
|
|
|
<link rel="stylesheet" href="../../uweb/style.css" type="text/css" />
|
2020-11-24 13:24:22 +00:00
|
|
|
|
<title>定时脚本</title>
|
2022-06-30 03:43:09 +00:00
|
|
|
|
<script type="text/javascript">
|
2022-07-12 02:24:02 +00:00
|
|
|
|
function findLang(){
|
2022-06-30 03:43:09 +00:00
|
|
|
|
let href = location.href;
|
|
|
|
|
for(let i=href.length-1;i>0;i--){
|
|
|
|
|
if('/'==href.charAt(i) && '/'==href.charAt(i-3))
|
2022-07-12 02:24:02 +00:00
|
|
|
|
return i;
|
2022-06-30 03:43:09 +00:00
|
|
|
|
}
|
2022-07-12 02:24:02 +00:00
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
function nav2(page){
|
|
|
|
|
let i = findLang();
|
|
|
|
|
location.href = location.href.substring(0,i+1)+page;
|
|
|
|
|
}
|
|
|
|
|
function nav2Lang(lang){
|
|
|
|
|
let i = findLang();
|
|
|
|
|
let href = location.href;
|
|
|
|
|
location.href = location.href.substring(0,i-2)+lang+location.href.substring(i);
|
2022-06-30 03:43:09 +00:00
|
|
|
|
}
|
|
|
|
|
</script>
|
2020-11-24 13:24:22 +00:00
|
|
|
|
</head>
|
|
|
|
|
<body>
|
|
|
|
|
<header class='header'>
|
2022-06-30 03:43:09 +00:00
|
|
|
|
<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>
|
2022-07-12 02:24:02 +00:00
|
|
|
|
|
2020-11-24 13:24:22 +00:00
|
|
|
|
<nav>
|
|
|
|
|
</nav>
|
|
|
|
|
</header>
|
|
|
|
|
<br />
|
|
|
|
|
|
|
|
|
|
<div class="container">
|
|
|
|
|
<h1 class="title">定时脚本
|
|
|
|
|
<br>
|
|
|
|
|
<span class="subtitle"></span>
|
|
|
|
|
</h1>
|
|
|
|
|
<ul class="tags">
|
|
|
|
|
|
|
|
|
|
</ul>
|
|
|
|
|
<p>如果勾选“文件预处理”,则uweb启动时运行"default.rc" shell脚本。可与tcron定时管<br>
|
2022-06-07 22:46:18 +00:00
|
|
|
|
理工具(<a href="i:0bhttps://fastly.jsdelivr.net/gh/torappinfo/uwebjs/bin/tcron.tgz">安装tcron</a>)配合运行定时任务,如存储清理、网页签到等。</p>
|
2021-01-23 02:56:36 +00:00
|
|
|
|
<p>勾选“文件预处理”的情况下,如果存在文件"default.rc2",则在超微浏览器成为前台时,此文件代码被执行。在超微永不退出的情况下,"default.rc"将没有任何执行机会,而"default.rc2"保证即使超微长时间不重启,定时脚本仍可以执行。</p>
|
2020-11-24 13:24:22 +00:00
|
|
|
|
<h4 id="tcron">tcron</h4>
|
|
|
|
|
<p>usage: tcron logfile command hours [timezone delay_sec elsecommand]<br>
|
|
|
|
|
指定时间范围内如果命令没有被执行过,则tcron会执行一次命令。<br>
|
|
|
|
|
其中logfile可以不记录任何log,成功执行命令以后只需更新一下改动时间即可。<br>
|
2021-01-22 10:04:02 +00:00
|
|
|
|
hours: 如果为正整数,则将每天划分为不同的时间区间(单位小时),每个区间命令只能执行一次。如果为负整数,则取绝对值,并且单位为分钟,保证下一次执行至少间隔这么多分钟。<br>
|
2021-02-14 08:37:47 +00:00
|
|
|
|
hours也可以为"hh:mm-hh:mm,..."格式, 譬如"6:00-8:30,11:00-13:00,5:30-6:30"为每天三餐时间脚本执行一次。<br>
|
2020-11-24 13:24:22 +00:00
|
|
|
|
timezone: 时区:譬如“8”表示北京时间。(默认为8)<br>
|
|
|
|
|
delay_sec: 等待指定秒数后再执行命令,防止命令被集中执行。<br>
|
|
|
|
|
elsecommand: 无需执行命令command时执行。</p>
|
|
|
|
|
<p>ex:<br>
|
|
|
|
|
set PATH=/system/bin:/data/data/info.torapp.uweb/files/bin<br>
|
|
|
|
|
#天翼云每天签到一次<br>
|
|
|
|
|
tcron /sdcard/a "cloud189-go sign;toybox touch /sdcard/a" 24<br>
|
|
|
|
|
#每30天清空baidu目录<br>
|
|
|
|
|
tcron /sdcard/b "rm -rf /sdcard/baidu/*;toybox touch /sdcard/b" 720</p>
|
2022-08-11 11:14:34 +00:00
|
|
|
|
<p><a target="_self" href="i:0hdefault.rc:https://fastly.jsdelivr.net/gh/torappinfo/uweb/zh/searchurl/txt/default.rc">安装default.rc模板文件(termux)</a></p>
|
2020-11-24 13:24:22 +00:00
|
|
|
|
<p>可能用到的命令:<br>
|
|
|
|
|
termux中安装remind,可配置各类提醒功能,十分强大。<br>
|
|
|
|
|
apt install remind</p>
|
|
|
|
|
<p>am start -n info.torapp.uweb/.wvActivity -d 'javascript:alert("remind")' #提醒<br>
|
|
|
|
|
其中-d后面参数可以为任意url包括超微内部"i:" url。</p>
|
2021-01-20 13:25:47 +00:00
|
|
|
|
<h4 id="cron">cron</h4>
|
|
|
|
|
<p>Termux下安装cronie:<br>
|
|
|
|
|
apt install cronie<br>
|
|
|
|
|
crontab -e</p>
|
|
|
|
|
<p>crontab例子内容如下:<br>
|
|
|
|
|
30,31 20-23/1 * * * node Loon/jd_live_redrain.js<br>
|
|
|
|
|
0,1 19-21/1 * * * node Loon/jd_live_redrain2.js<br>
|
|
|
|
|
0,1 0,9,11,13,15,17,19,20,21,23 * * * node Loon/jd_live_redrain_nian.js<br>
|
|
|
|
|
0,1 0,9,11,13,15,17,19,20,21,23 * * * node Loon/jd_live_redrain_official.js<br>
|
|
|
|
|
30,31 12-23/1 * * * node Loon/jd_live_redrain_half.js</p>
|
|
|
|
|
<p>Termux下运行:crond<br>
|
|
|
|
|
cron运行期间保持唤醒锁,保证termux可以稳定运行。</p>
|
2020-11-24 13:24:22 +00:00
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
</body>
|
|
|
|
|
</html>
|