I would like to find how to create Scheduled Tasks to execute a User-Defined Scripts on Synology using commands in a shell script. But I don’t find how-to. Here are the only info I was able to get.
Click to Read More
The tasks created via Control Panel > Task Scheduler > Create > Scheduled Task > User-defined Script, are stored in the file /etc/crontab. Ex.:
#minute hour mday month wday who command
25 1 * * 1,4 root /tmp/synoschedtask –run id=1
|
The tasks id are stored in /usr/syno/etc/scheduled_tasks. Ex.:
[1] id=1 last work hour=23 can edit owner=1 can delete from ui=1 edit dialog=SYNO.SDS.TaskScheduler.EditDialog type=daily action=#common:run#: /usr/local/bin/php73 /var/packages/MODS_ServerMonitor/target/ui/cron/status.cron.php can edit from ui=1 week=1111111 app name=#common:command_line# name=Update Server Mon can run app same time=1 owner=0 repeat min store config=[1,5,10,15,20,30]repeat hour store config=[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23]simple edit form=1 repeat hour=0 listable=1 app args={“notify_enable”:false,”notify_if_error”:false,”notify_mail”:””,”script”:”/usr/local/bin/php73 /var/packages/MODS_ServerMonitor/target/ui/cron/status.cron.php”} state=enabled can run task same time=0 start day=0 cmd=L3Vzci9sb2NhbC9iaW4vcGhwNzMgL3Zhci9wYWNrYWdlcy9NT0RTX1NlcnZlck1vbml0b3IvdGFyZ2V0L3VpL2Nyb24vc3RhdHVzLmNyb24ucGhw run hour=0 edit form=SYNO.SDS.TaskScheduler.Script.FormPanel app=SYNO.SDS.TaskScheduler.Script run min=0 start month=0 can edit name=1 start year=0 can run from ui=1 repeat min=15 |
The task can also be displayed via a command line run as root (See here): sudo synoschedtask –get id = 1
ID: [1] Name: [Update Server Mon] State: [enabled] Owner: [root] Type: [daily] Start date: [0/0/0] Run time: [0]:[0] Repeat every [15] min (s) until [23]:[45] Command: [/usr/local/bin/php73 /var/packages/MODS_ServerMonitor/target/ui/cron/status.cron.php] Last Run Time: Mon Oct 28 23:00:02 2019 Status: [Success] |
Leave a Reply