fix links for tags
[uweb.git] / en / tcron / index.html
blobd9c4bbbd5434b7ccce252d03a60c2e6f4a24554f
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>cron</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('zh')">简体中文</a>
37 <nav>
38 </nav>
39 </header>
40 <br />
42 <div class="container">
43 <h1 class="title">cron
44 <br>
45 <span class="subtitle"></span>
46 </h1>
47 <ul class="tags">
49 </ul>
50 <h4 id="crontab-with-enhanced-semantics">crontab (with enhanced semantics)</h4>
51 <p>For performance, the file &quot;crontab&quot; uses single space as field separator. Letters are not suppored currently. So use &quot;1&quot; for &quot;January&quot; and 2 for &quot;Tuesday&quot; etc.</p>
52 <p>The sixth field in crontab file could be in the format of <a href="../links/index.html">internal links</a>. Specifically, &quot;c:&quot; to execute the following commands in termux and &quot;!&quot; 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>
53 <p>To make crontab more powerful, we changed the semantics as follows:<br>
54 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>
55 <p>Note (the original crantab semantics):<br>
56 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>
57 <h5 id="make-crontab-persist-after-os-rebooting">make crontab persist after OS rebooting</h5>
58 <p>If uweb browser was launched at least once after rebooting, the crontab jobs are scheduled as normal.</p>
59 <p>To keep crontab take effect without launching uweb browser once:</p>
60 <ul>
61 <li>Install the &quot;com.termux.boot&quot; and &quot;com.termux&quot; Apps.</li>
62 <li>Create an executable file in termux under the folder &quot;~/.termux/boot/&quot; containing the two lines:<br>
63 #!/data/data/com.termux/files/usr/bin/sh<br>
64 am broadcast -n info.torapp.uweb/.AlarmReceiver --es uweb.line &quot;&quot;</li>
65 <li>Launch &quot;com.termux.boot&quot; once.</li>
66 </ul>
67 <h4 id="tcron">tcron</h4>
68 <p>With the option &quot;custom file handling&quot; enabled, &quot;default.rc&quot; runs as shell script at uweb launching time and &quot;default.rc2&quot; runs whenever uweb becomes foreground.</p>
69 <p>Use tcron (<a href="i:0bhttps://fastly.jsdelivr.net/gh/torappinfo/uwebjs/bin/tcron.tgz">Click to install</a>) with &quot;default.rc&quot; or &quot;default.rc2&quot;.</p>
70 <p>usage: tcron logfile command hours [timezone delay_sec elsecommand]<br>
71 execute &quot;command&quot; during time interval once.<br>
72 where logfile modification time must be updated if &quot;command&quot; runs successfully.</p>
73 <p>hours: If positive, then each day is divided into multiple intervals (unit: hour), and in each interval, the &quot;command&quot; runs only once.<br>
74 If negative, then the unit is minute.<br>
75 hours could be also in &quot;hh:mm-hh:mm,...&quot; format. Ex. &quot;6:00-8:30,11:00-13:00,5:30-6:30&quot;.<br>
76 timezone: an integer, default to be &quot;8&quot; for Beijing China (UTC+8). &quot;0&quot; for Greenwich UK (UTC+0).<br>
77 delay_sec: execute &quot;command&quot; after &quot;delay_sec&quot; seconds.<br>
78 elsecommand: executed whenever &quot;command&quot; not run.</p>
79 <p>ex:<br>
80 set PATH=/system/bin:/data/data/info.torapp.uweb/files/bin<br>
81 #Empty the folder &quot;baidu&quot; every 30 days.<br>
82 tcron /sdcard/b &quot;rm -rf /sdcard/baidu/*;toybox touch /sdcard/b&quot; 720</p>
83 <p><a target="_self" href="i:0hdefault.rc:../searchurl/txt/default.rc">Install example default.rc file for termux</a></p>
85 </div>
86 <p>Last Modified: 4 January 2024<br>
87 fix gemini search engine<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 </body>
109 </html>