5 <meta name=
"viewport" content=
"width=device-width, initial-scale=1" />
7 <link rel=
"stylesheet" href=
"../style.css#" type=
"text/css" />
9 <script type=
"text/javascript">
11 let href
= location
.href
;
12 for(let i
=href
.length
-1;i
>0;i
--){
13 if('/'==href
.charAt(i
) && '/'==href
.charAt(i
-3))
20 location
.href
= location
.href
.substring(0,i
+1)+page
;
22 function nav2Lang(lang
){
24 let href
= location
.href
;
25 location
.href
= location
.href
.substring(0,i
-2)+lang
+location
.href
.substring(i
);
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('zh')">简体中文
</a>
42 <div class=
"container">
43 <h1 class=
"title">cron
45 <span class=
"subtitle"></span>
50 <h4 id=
"crontab-with-enhanced-semantics">crontab (with enhanced semantics)
</h4>
51 <p>Some battery restrictions on android
13+ may disallow new instance of uweb browser by alarm events. Users can either keep uweb instance (no battery consumption) or remove the restriction for uweb.
</p>
52 <p>For performance, the file
"crontab
" uses single space as field separator. Letters are not suppored currently. So use
"1" for
"January
" and
2 for
"Tuesday
" etc.
</p>
53 <p>The sixth field in crontab file could be in the format of
<a href=
"../links/index.html#">internal links
</a>. Specifically,
"c:
" to execute the following commands in termux and
"!
" to execute commands directly. If the sixth field is not in any of above formats, then the field will appear as the message of alarm clock.
</p>
54 <p>To make crontab more powerful, we changed the semantics as follows:
<br>
55 The day of a command's execution can be specified by two fields — day of month, and day of week. The command will be run when
<span style=
"color:red">both
</span> fields matche the current time.
</p>
56 <p>Note (the original crantab semantics):
<br>
57 The day of a command's execution can be specified by two fields — day of month, and day of week. If both fields are restricted (i.e., aren't *), the command will be run when either field matches the current time. For example,
"30 4 1,
15 *
5" would cause a command to be run at
4:
30 am on the
1st and
15th of each month, plus every Friday.
</p>
58 <h5 id=
"make-crontab-persist-after-os-rebooting">make crontab persist after OS rebooting
</h5>
59 <p>If uweb browser was launched at least once after rebooting, the crontab jobs are scheduled as normal.
</p>
60 <p>To keep crontab take effect without launching uweb browser once:
</p>
62 <li>Install the
"com.termux.boot
" and
"com.termux
" Apps.
</li>
63 <li>Create an executable file in termux under the folder
"~/.termux/boot/
" containing the two lines:
<br>
64 #!/data/data/com.termux/files/usr/bin/sh
<br>
65 am broadcast -n info.torapp.uweb/.AlarmReceiver --es uweb.line
""</li>
66 <li>Launch
"com.termux.boot
" once.
</li>
68 <h4 id=
"tcron">tcron
</h4>
69 <p>With the option
"custom file handling
" enabled,
"default.rc
" runs as shell script at uweb launching time and
"default.rc2
" runs whenever uweb becomes foreground.
</p>
70 <p>Use tcron (
<a href=
"i:0bhttps://fastly.jsdelivr.net/gh/torappinfo/uwebjs/bin/tcron.tgz">Click to install
</a>) with
"default.rc
" or
"default.rc2
".
</p>
71 <p>usage: tcron logfile command hours [timezone delay_sec elsecommand]
<br>
72 execute
"command
" during time interval once.
<br>
73 where logfile modification time must be updated if
"command
" runs successfully.
</p>
74 <p>hours: If positive, then each day is divided into multiple intervals (unit: hour), and in each interval, the
"command
" runs only once.
<br>
75 If negative, then the unit is minute.
<br>
76 hours could be also in
"hh:mm-hh:mm,...
" format. Ex.
"6:
00-
8:
30,
11:
00-
13:
00,
5:
30-
6:
30".
<br>
77 timezone: an integer, default to be
"8" for Beijing China (UTC+
8).
"0" for Greenwich UK (UTC+
0).
<br>
78 delay_sec: execute
"command
" after
"delay_sec
" seconds.
<br>
79 elsecommand: executed whenever
"command
" not run.
</p>
81 set PATH=/system/bin:/data/data/info.torapp.uweb/files/bin
<br>
82 #Empty the folder
"baidu
" every
30 days.
<br>
83 tcron /sdcard/b
"rm -rf /sdcard/baidu/*;toybox touch /sdcard/b
" 720</p>
84 <p><a target=
"_self" href=
"i:0hdefault.rc:../searchurl/txt/default.rc">Install example default.rc file for termux
</a></p>
87 <p>Last Modified:
27 August
2024<br>
88 update ebrowserreadme.md
<br>
93 src='https://giscus.app/client.js'
94 data-repo=
"torappinfo/uweb"
95 data-repo-id=
"MDEwOlJlcG9zaXRvcnkzMDIyMDU3MjE="
96 data-category=
"Announcements"
97 data-category-id=
"DIC_kwDOEgNLGc4CQjsh"
100 data-reactions-enabled=
"1"
101 data-emit-metadata=
"0"
102 data-input-position=
"top"
106 crossorigin=
"anonymous" async
>
109 <footer class=
"site-footer">
110 <div class=
"container">
111 © 2018-
2024 Richard H. Cao
114 <!-- 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/>. -->