Open maddes-b opened 4 months ago
Played around on current DSM 7.2
API SYNO.Core.TaskScheduler
= Method list
/usr/syno/bin/synowebapi --exec-fastwebapi api="SYNO.Core.TaskScheduler" method="list" version="3"
<api call> | /usr/bin/jq -r --arg name "${TASKNAME}" '.data.tasks[] | select( .name == $name ) | .id'
= Method get
id
(TaskSchedulerUtils.js)real_owner
(TaskSchedulerUtils.js)/usr/syno/bin/synowebapi --exec-fastwebapi api="SYNO.Core.TaskScheduler" method="get" version="4"
= Method set_enable
status
array (admin_center.js)id
, real_owner
, enable
(admin_center.js)/usr/syno/bin/synowebapi --exec-fastwebapi api="SYNO.Core.TaskScheduler" method="set_enable" version="2"
= Method delete
tasks
array (admin_center.js)id
, real_owner
(admin_center.js)task
array (Metasploit)/usr/syno/bin/synowebapi --exec-fastwebapi api="SYNO.Core.TaskScheduler" method="delete" version="2"
= Method run
tasks
array (admin_center.js)id
, real_owner
(admin_center.js)task
array (Metasploit)/usr/syno/bin/synowebapi --exec-fastwebapi api="SYNO.Core.TaskScheduler" method="run" version="2"
= Method set
= Method create
name
, owner
, enable
, schedule
array, extra
array, type
(Metasploit)= Method view
= Method get_history_status_list
id
(admin_center.js)/usr/syno/bin/synowebapi --exec-fastwebapi api="SYNO.Core.TaskScheduler" method="get_history_status_list" version="1"
= Method get_history_log
id
(admin_center.js)timestamp
(admin_center.js)/usr/syno/bin/synowebapi --exec-fastwebapi api="SYNO.Core.TaskScheduler" method="get_history_log" version="1"
API SYNO.Core.TaskScheduler.Root
= Method set
= Method create
Nice! I will look into it!
Is your feature request related to a problem? Please describe. Want to enable/disable and run tasks via script.
Due to poorly conceived IPv6 support in DSM 7.x I want to run a script every minute after reboot, but only up to 15 minutes. So a reboot script will enable that task (planned minutely) and schedule another task in 15 mins to disable it again.
Describe the solution you'd like Using the API for Task Scheduler
Describe alternatives you've considered Schedules running every 5 mins to check for executing specific scripts, but this will not let NAS go into a deeper sleep mode. Wasting energy.
Additional context Did not find much about the TaskScheduler API, but there is some information to get a hold on it. I assume you are more experienced to find out API parameters than I.
/usr/bin/jq . /usr/syno/synoman/webapi/SYNO.Core.TaskScheduler.lib
(JSON with methods, unfortunately without parameters)grep -Rl -i -e 'SYNO.Core.TaskScheduler' /usr/syno
):P.S.: Already used APIs locally via script to import renewed certficates, that were done on another machine. See https://github.com/maddes-b/synology-nas-tools