asus router cron jobs - cru

最後更新: 2019-07-11

 


cron jobs - cru

 

Testing HW: RT-AC88U

"cru" commands inside a user script to re-generate your cron jobs at boot time.

cru

Cron Utility
add:    cru a <unique id> <"min hour day month week command">
delete: cru d <unique id>
list:   cru l

opts

a       # add

i.e.

# put your cron tasks in /var/spool/cron/crontabs

cru a 1 "* * * * * /jffs/ddns.sh > /dev/null"

l        # List

* * * * * /jffs/ddns.sh > /dev/null #1#

cronjob gone after reboot using cru

解決方案

cat /jffs/scripts/setMyCron.sh

cru a 1 "* * * * * /jffs/ddns.sh > /dev/null"

chmod a+rx /jffs/scripts/setMyCron.sh

echo "/bin/sh /jffs/scripts/setMyCron.sh" >> /jffs/scripts/init-start

P.S.

/jffs/ddns.sh

wget "http://Domain/u=x&p=y" -O /dev/null &> /dev/null

 


Boot 機時行某 Script

 

[方案1] 用 nvram variable "jffs2_exec" 實現

nvram set jffs2_exec=/jffs/scripts/init-start

# 要有此設定才 trigger jffs2_exec

nvram set jffs2_on=1

nvram commit

chmod o+x /jffs/scripts/init-start

 * script must be executable and include shebang (#!/bin/sh)

[方案2] 用 nvram variable "script_usbumount" 實現

nvram set script_usbumount=/jffs/scripts/init-start

nvram commit

 


nvram

 

https://datahunter.org/nvram

 


Block fb youtube

 

Block: Mon~Fri, 09:00~11:59 14:00~18:59

Link

 


Restart Panel

 

service restart_httpd

ps | grep httpd

16406 admin     5328 S    httpds -s -p 8443 -i br0
16407 admin     5328 S    httpd -i br0
16431 admin     1544 S    grep httpd