Skip to main content

TaskScheduler

Overview

Task Scheduler API implementation.

This API provides the functionality to get information related to the scheduler settings and current tasks.

Supported methods

  • Getters :
    • Get all tasks
    • Get task information
    • Get task results
    • Get output path for task results
  • Setters :
    • Set output path for task results
    • Set task settings
  • Actions :
    • Run task
    • Create task
    • Delete task
    • Enable task
    • Disable task

Methods

get_output_config

Retrieve tasks output configuration.

Internal API

SYNO.Core.EventScheduler

Returns

dict[str, object]
A dictionary containing a list of the tasks and information related to them.


get_task_list

List all present scheduled tasks and event triggered tasks.

Internal API

SYNO.Core.TaskScheduler

Parameters

sort_by str, optional
The field to sort tasks by. Defaults to "next_trigger_time".
Possible values:

  • "next_trigger_time"
  • "name"
  • "type"
  • "action"
  • "owner"

sort_direction str, optional
The sort direction. Defaults to "ASC".
Possible values:

  • "ASC"
  • "DESC"

offset int, optional
Task offset for pagination. Defaults to 0.

limit int, optional
Number of tasks to retrieve. Defaults to 50.

Returns

dict[str, object]
A dictionary containing a list of the tasks and information related to them.

Example return

Click to expand
{
"data": {
"tasks": [
{
"action": "Run: rsync -aP --delete /volume1/test/ /volume1/test2/",
"can_delete": true,
"can_edit": true,
"can_run": true,
"enable": false,
"id": 13,
"name": "Sync folders",
"next_trigger_time": "2024-09-09 12:26",
"owner": "root",
"real_owner": "root",
"type": "script"
},
{
"action": "Run: echo hello > /tmp/awacate.out",
"can_delete": true,
"can_edit": true,
"can_run": true,
"enable": true,
"id": 11,
"name": "TEST_CRONTAB",
"next_trigger_time": "2024-09-10 00:00",
"owner": "root",
"real_owner": "root",
"type": "script"
}
]
"total": 2
},
"success": true
}

get_task_config

Retrieve the configuration for a specific task or list of all the available services and their corresponding IDs.

Internal API

SYNO.Core.TaskScheduler

Parameters

task_id int
The ID of the task to retrieve the configuration for. Pass -1 to get a list of all available services with their IDs.

real_owner str
The task real owner, usually it is root, you can double check from the result of get_task_config().

type str, optional
The type of task (e.g., 'service'). Pass "service" to get a list of all available services with their IDs. Defaults to "".

Returns

dict[str, object]
A dictionary containing the task configuration.

Example return

Click to expand
{
"data": {
"action": "Run: echo hello > /tmp/awacate.out",
"can_edit_name": true,
"can_edit_owner": true,
"enable": true,
"extra": {
"notify_enable": false,
"notify_if_error": false,
"notify_mail": "",
"script": "echo hello > /tmp/awacate.out"
},
"id": 11,
"name": "TEST_CRONTAB",
"owner": "root",
"real_owner": "root",
"schedule": {
"date": "2024/9/11",
"date_type": 0,
"hour": 0,
"last_work_hour": 0,
"minute": 0,
"monthly_week": [],
"repeat_date": 1001,
"repeat_hour": 0,
"repeat_hour_store_config": [
1..23
],
"repeat_min": 0,
"repeat_min_store_config": [
1,
...
],
"version": 4,
"week_day": "0,1,2,3,4,5,6"
},
"type": "script"
},
"success": true
}

get_task_results

Retrieve the results list for a specific task.

Internal API

SYNO.Core.TaskScheduler

Parameters

task_id int
The ID of the task to retrieve the results for.

Returns

dict[str, object]
A dictionary containing the task results.

Example return

Click to expand
{
"data": [
{
"exit_code": 127,
"exit_type": "by_signal",
"start_time": "2024-09-11 00:00:01",
"stop_time": "2024-09-11 00:00:06",
"timestamp": "1726005601"
},
{
"exit_code": 0,
"exit_type": "normal",
"start_time": "2024-06-01 00:00:01",
"stop_time": "2024-06-01 00:00:02",
"timestamp": "1717192801"
}
],
"success": true
}

set_output_config

Configure the output settings for tasks results.

Internal API

SYNO.Core.EventScheduler

Parameters

enable_output bool
Whether to enable result logging or not.

output_path str, optional
The path where the result logs will be stored, e.g. share/scripts_output'. Defaults to "".

Returns

dict[str, object]
A dictionary containing the result of the output configuration.

Example return

Click to expand
{
"success": true
}

task_set_enable

Enable or disable a task.

Internal API

SYNO.Core.TaskScheduler

Parameters

task_id int
The ID of the task to be enabled.

real_owner str
The task real owner, usually it is root, you can double check from the result of get_task_config().

enable bool
Wheter to enable (True) or disable (False) the task.

Returns

dict[str, object]
A dictionary containing the result of the task enabling.

Example return

Click to expand
{
"success": true
}

task_run

Run a specific task.

Internal API

SYNO.Core.TaskScheduler

Parameters

task_id int
The ID of the task to be run.

real_owner str
The task real owner, usually it is root, you can double check from the result of get_task_config().

Returns

dict[str, object]
A dictionary containing the result of the task execution.

Example return

Click to expand
{
"success": true
}

task_delete

Delete a specific task.

Internal API

SYNO.Core.TaskScheduler

Parameters

task_id int
The ID of the task to be deleted.

real_owner str
The task real owner, usually it is root, you can double check from the result of get_task_config().

Returns

dict[str, object]
A dictionary containing the result of the task deletion.

Example return

Click to expand
{
"success": true
}

create_script_task

Create a new Script task with the provided schedule and notification settings.

tip

If the task needs to run with root privileges, please specify the owner as "root".

Internal API

SYNO.Core.TaskScheduler

Parameters

task_name str
The name of the task.

owner str
The task owner. If the task needs to run with root privileges, please specify the owner as "root".

script str
The script to be executed.

enable bool, optional
Whether the task should be enabled upon creation. Defaults to True.

run_frequently bool, optional
Determines whether the task runs on a recurring schedule (True) or only on a specific date (False). Defaults to True.

run_days str, optional
Days of the week when the task should run, used if run_frequently is set to True, specified as a comma-separated list (e.g., '0,1,2' for Sunday, Monday, Tuesday). Defaults to '0,1,2,3,4,5,6' (Daily).

run_date str, optional
The specific date the task should run, used if run_frequently is set to False. Format: yyyy/m/d (no prefix zeros). Defaults to "".

repeat str, optional
How often the task should repeat. Defaults to daily.
Possible values:

  • daily -> Only when 'run_frequently=True'
  • weekly -> Only when 'run_frequently=True'
  • monthly -> Works for both 'run_frequently=True' and 'run_frequently=False'
  • no_repeat -> Only when 'run_frequently=False'
  • every_3_months -> Only when 'run_frequently=False'
  • every_6_months -> Only when 'run_frequently=False'
  • yearly -> Only when 'run_frequently=False'

monthly_week list[str], optional
If run_frequently=True and repeat='monthly', specifies the weeks the task should run, e.g., ['first', 'third'].
Defaults to [].

start_time_h int, optional
Hour at which the task should start. Defaults to 0.

start_time_m int, optional
Minute at which the task should start. Defaults to 0.

same_day_repeat_h int, optional
Number of hours between repeated executions on the same day (run every x hours), if "Continue running within the same day" is desired.
Set to 0 to disable same-day repeats. Defaults to 0 (disable same day repeat).
Possible values: 0..23
The args same_day_repeat_h and same_day_repeat_m cannot be used at the same time, if both are passed, same_day_repeat_h will be prioritized.

same_day_repeat_m int, optional
Number of minutes between repeated executions on the same day (run every x minutes), if "Continue running within the same day" is desired.
Set to 0 to disable same-day repeats. Defaults to 0 (disable same day repeat).
Posible values: 1, 5, 10, 15, 20, 30
The args same_day_repeat_h and same_day_repeat_m cannot be used at the same time, if both are passed, same_day_repeat_h will be prioritized.

same_day_repeat_until int, optional
Last hour of the day when the task can repeat. Defaults to start_time_h.

notify_email str, optional
Email address to send notifications to. Defaults to "", thus disabling the notification feature.

notify_only_on_error bool, optional
If True, notifications are only sent when an error occurs. Defaults to False.

Returns

dict[str, object]
A dictionary with the id of the created task.

Example return

Click to expand
{
"data": {
"id": 20
},
"success": true
}

modify_script_task

Modify settings of a Script task.

warning

This method overwrites all the settings of the task, so if you only want to change one setting, you can fetch the current task configuration with get_task_config() and pass all the settings to this method.

tip

If the task needs to run with root privileges, please specify the owner as "root".

Internal API

SYNO.Core.TaskScheduler

Parameters

task_id int
The ID of the task.

task_name str
The name of the task.

owner str
The task owner. If the task needs to run with root privileges, please specify the owner as "root".

real_owner str
The task real owner, usually it is root, you can double check from the result of get_task_config().

script str
The script to be executed.

enable bool, optional
Whether the task should be enabled upon creation. Defaults to True.

run_frequently bool, optional
Determines whether the task runs on a recurring schedule (True) or only on a specific date (False). Defaults to True.

run_days str, optional
Days of the week when the task should run, used if run_frequently is set to True, specified as a comma-separated list (e.g., '0,1,2' for Sunday, Monday, Tuesday). Defaults to '0,1,2,3,4,5,6' (Daily).

run_date str, optional
The specific date the task should run, used if run_frequently is set to False. Format: yyyy/m/d (no prefix zeros). Defaults to "".

repeat str, optional
How often the task should repeat. Defaults to 'daily'.
Possible values:

  • daily -> Only when 'run_frequently=True'
  • weekly -> Only when 'run_frequently=True'
  • monthly -> Works for both 'run_frequently=True' and 'run_frequently=False'
  • no_repeat -> Only when 'run_frequently=False'
  • every_3_months -> Only when 'run_frequently=False'
  • every_6_months -> Only when 'run_frequently=False'
  • yearly -> Only when 'run_frequently=False'

monthly_week list[str], optional
If run_frequently=True and repeat='monthly', specifies the weeks the task should run, e.g., ['first', 'third']. Defaults to [].

start_time_h int, optional
Hour at which the task should start. Defaults to 0.

start_time_m int, optional
Minute at which the task should start. Defaults to 0.

same_day_repeat_h int, optional
Number of hours between repeated executions on the same day (run every x hours), if "Continue running within the same day" is desired. Set to 0 to disable same-day repeats. Defaults to 0.
Possible values: 0..23
The args same_day_repeat_h and same_day_repeat_m cannot be used at the same time, if both are passed, same_day_repeat_h will be prioritized.

same_day_repeat_m int, optional
Number of minutes between repeated executions on the same day (run every x minutes), if "Continue running within the same day" is desired. Set to 0 to disable same-day repeats. Defaults to 0.
Posible values: 1, 5, 10, 15, 20, 30
The args same_day_repeat_h and same_day_repeat_m cannot be used at the same time, if both are passed, same_day_repeat_h will be prioritized.

same_day_repeat_until int, optional
Last hour of the day when the task can repeat. Defaults to start_time_h.

notify_email str, optional
Email address to send notifications to. Defaults to "", thus disabling the notification feature.

notify_only_on_error bool, optional
If True, notifications are only sent when an error occurs. Defaults to False.

Returns

dict[str, object]
A dictionary with the id of the created task.

Example return

Click to expand
{
"data": {
"id": 20
},
"success": true
}

create_beep_control_task

Create a new Beep Control task with the provided schedule and beep duration.

Internal API

SYNO.Core.TaskScheduler

Parameters

task_name str
The name of the task.

owner str
The task owner.

beep_duration int, optional
The amount of seconds the beep will be triggered for, in seconds. Defaults to 60.

enable bool, optional
Whether the task should be enabled upon creation. Defaults to True.

run_frequently bool, optional
Determines whether the task runs on a recurring schedule (True) or only on a specific date (False). Defaults to True.

run_days str, optional
Days of the week when the task should run, used if run_frequently is set to True, specified as a comma-separated list (e.g., '0,1,2' for Sunday, Monday, Tuesday). Defaults to '0,1,2,3,4,5,6' (Daily).

run_date str, optional
The specific date the task should run, used if run_frequently is set to False. Format: yyyy/m/d (no prefix zeros). Defaults to "".

repeat str, optional
How often the task should repeat. Defaults to 'daily'.
Possible values:

  • daily -> Only when 'run_frequently=True'
  • weekly -> Only when 'run_frequently=True'
  • monthly -> Works for both 'run_frequently=True' and 'run_frequently=False'
  • no_repeat -> Only when 'run_frequently=False'
  • every_3_months -> Only when 'run_frequently=False'
  • every_6_months -> Only when 'run_frequently=False'
  • yearly -> Only when 'run_frequently=False'

monthly_week list[str], optional
If run_frequently=True and repeat='monthly', specifies the weeks the task should run, e.g., ['first', 'third']. Defaults to [].

start_time_h int, optional
Hour at which the task should start. Defaults to 0.

start_time_m int, optional
Minute at which the task should start. Defaults to 0.

same_day_repeat_h int, optional
Number of hours between repeated executions on the same day (run every x hours), if "Continue running within the same day" is desired. Set to 0 to disable same-day repeats. Defaults to 0.
Possible values: 0..23
The args same_day_repeat_h and same_day_repeat_m cannot be used at the same time, if both are passed, same_day_repeat_h will be prioritized.

same_day_repeat_m int, optional
Number of minutes between repeated executions on the same day (run every x minutes), if "Continue running within the same day" is desired. Set to 0 to disable same-day repeats. Defaults to 0.
Posible values: 1, 5, 10, 15, 20, 30
The args same_day_repeat_h and same_day_repeat_m cannot be used at the same time, if both are passed, same_day_repeat_h will be prioritized.

same_day_repeat_until int, optional
Last hour of the day when the task can repeat. Defaults to start_time_h.

Returns

dict[str, object]
A dictionary with the id of the created task.

Example return

Click to expand
{
"data": {
"id": 20
},
"success": true
}

modify_beep_control_task

Modify settings of a Beep Control task.

warning

This method overwrites all the settings of the task, so if you only want to change one setting, you can fetch the current task configuration with get_task_config() and pass all the settings to this method.

Internal API

SYNO.Core.TaskScheduler

Parameters

task_name str
The name of the task.

real_owner str
The task owner.

beep_duration int, optional
The amount of seconds the beep will be triggered for, in seconds. Defaults to 60.

enable bool, optional
Whether the task should be enabled upon creation. Defaults to True.

run_frequently bool, optional
Determines whether the task runs on a recurring schedule (True) or only on a specific date (False). Defaults to True.

run_days str, optional
Days of the week when the task should run, used if run_frequently is set to True, specified as a comma-separated list (e.g., '0,1,2' for Sunday, Monday, Tuesday). Defaults to '0,1,2,3,4,5,6' (Daily).

run_date str, optional
The specific date the task should run, used if run_frequently is set to False. Format: yyyy/m/d (no prefix zeros). Defaults to "".

repeat str, optional
How often the task should repeat. Defaults to 'daily'.
Possible values:

  • daily -> Only when 'run_frequently=True'
  • weekly -> Only when 'run_frequently=True'
  • monthly -> Works for both 'run_frequently=True' and 'run_frequently=False'
  • no_repeat -> Only when 'run_frequently=False'
  • every_3_months -> Only when 'run_frequently=False'
  • every_6_months -> Only when 'run_frequently=False'
  • yearly -> Only when 'run_frequently=False'

monthly_week list[str], optional
If run_frequently=True and repeat='monthly', specifies the weeks the task should run, e.g., ['first', 'third']. Defaults to [].

start_time_h int, optional
Hour at which the task should start. Defaults to 0.

start_time_m int, optional
Minute at which the task should start. Defaults to 0.

same_day_repeat_h int, optional
Number of hours between repeated executions on the same day (run every x hours), if "Continue running within the same day" is desired.
Set to 0 to disable same-day repeats. Defaults to 0.
Possible values: 0..23

info

The args same_day_repeat_h and same_day_repeat_m cannot be used at the same time, if both are passed, same_day_repeat_h will be prioritized.

same_day_repeat_m int, optional
Number of minutes between repeated executions on the same day (run every x minutes), if "Continue running within the same day" is desired.
Set to 0 to disable same-day repeats. Defaults to 0.
Posible values: 1, 5, 10, 15, 20, 30

info

The args same_day_repeat_h and same_day_repeat_m cannot be used at the same time, if both are passed, same_day_repeat_h will be prioritized.

same_day_repeat_until int, optional
Last hour of the day when the task can repeat. Defaults to start_time_h.

Returns

dict[str, object]
A dictionary with the id of the created task.

Example return

Click to expand
{
"data": {
"id": 20
},
"success": true
}

create_service_control_task

Create a new Service Control task with the provided schedule and services to start/stop.

Internal API

SYNO.Core.TaskScheduler

Parameters

task_name str
The name of the task.

owner str
The task owner.

services (list) ``
A list containing the services and their type to be influenced by the specified action (start / stop).
To get a list of all the available services and their corresponding IDs, call get_task_config(task_id=-1, real_owner=your_username, type='service').
E.g.:

[
{'id': 'AudioStation', 'type': 'package'},
{'id': 'HyperBackup', 'type': 'package'},
{'id': 'Samba', 'type': 'service'}
]

action str
The action to apply to the services. Either 'start' or 'stop'.

enable bool, optional
Whether the task should be enabled upon creation. Defaults to True.

run_frequently bool, optional
Determines whether the task runs on a recurring schedule (True) or only on a specific date (False). Defaults to True.

run_days str, optional
Days of the week when the task should run, used if run_frequently is set to True, specified as a comma-separated list (e.g., '0,1,2' for Sunday, Monday, Tuesday). Defaults to '0,1,2,3,4,5,6' (Daily).

run_date str, optional
The specific date the task should run, used if run_frequently is set to False. Format: yyyy/m/d (no prefix zeros). Defaults to "".

repeat str, optional
How often the task should repeat. Defaults to 'daily'.
Possible values:

  • daily -> Only when 'run_frequently=True'
  • weekly -> Only when 'run_frequently=True'
  • monthly -> Works for both 'run_frequently=True' and 'run_frequently=False'
  • no_repeat -> Only when 'run_frequently=False'
  • every_3_months -> Only when 'run_frequently=False'
  • every_6_months -> Only when 'run_frequently=False'
  • yearly -> Only when 'run_frequently=False'

monthly_week list[str], optional
If run_frequently=True and repeat='monthly', specifies the weeks the task should run, e.g., ['first', 'third']. Defaults to [].

start_time_h int, optional
Hour at which the task should start. Defaults to 0.

start_time_m int, optional
Minute at which the task should start. Defaults to 0.

same_day_repeat_h int, optional
Number of hours between repeated executions on the same day (run every x hours), if "Continue running within the same day" is desired.
Set to 0 to disable same-day repeats. Defaults to 0.
Possible values: 0..23

info

The args same_day_repeat_h and same_day_repeat_m cannot be used at the same time, if both are passed, same_day_repeat_h will be prioritized.

same_day_repeat_m int, optional
Number of minutes between repeated executions on the same day (run every x minutes), if "Continue running within the same day" is desired.
Set to 0 to disable same-day repeats. Defaults to 0.
Posible values: 1, 5, 10, 15, 20, 30

info

The args same_day_repeat_h and same_day_repeat_m cannot be used at the same time, if both are passed, same_day_repeat_h will be prioritized.

same_day_repeat_until int, optional
Last hour of the day when the task can repeat. Defaults to start_time_h.

Returns

dict[str, object]
A dictionary with the id of the created task.

Example return

Click to expand
{
"data": {
"id": 20
},
"success": true
}

modify_service_control_task

Modify settings of a Service Control task.

warning

This method overwrites all the settings of the task, so if you only want to change one setting, you can fetch the current task configuration with get_task_config() and pass all the settings to this method.

Internal API

SYNO.Core.TaskScheduler

Parameters

task_id int
The ID of the task.

task_name str
The name of the task.

real_owner str
The task real owner, usually it is root, you can double check from the result of get_task_config().

services (list) ``
A list containing the services and their type to be influenced by the specified action (start / stop).
To get a list of all the available services and their corresponding IDs, call get_task_config(task_id=-1, real_owner=your_username, type='service').
E.g.:

[
{'id': 'AudioStation', 'type': 'package'},
{'id': 'HyperBackup', 'type': 'package'},
{'id': 'Samba', 'type': 'service'}
]

action str
The action to apply to the services. Either 'start' or 'stop'.

enable bool, optional
Whether the task should be enabled upon creation. Defaults to True.

run_frequently bool, optional
Determines whether the task runs on a recurring schedule (True) or only on a specific date (False). Defaults to True.

run_days str, optional
Days of the week when the task should run, used if run_frequently is set to True, specified as a comma-separated list (e.g., '0,1,2' for Sunday, Monday, Tuesday). Defaults to '0,1,2,3,4,5,6' (Daily).

run_date str, optional
The specific date the task should run, used if run_frequently is set to False. Format: yyyy/m/d (no prefix zeros). Defaults to "".

repeat str, optional
How often the task should repeat. Defaults to 'daily'.
Possible values:

  • daily -> Only when 'run_frequently=True'
  • weekly -> Only when 'run_frequently=True'
  • monthly -> Works for both 'run_frequently=True' and 'run_frequently=False'
  • no_repeat -> Only when 'run_frequently=False'
  • every_3_months -> Only when 'run_frequently=False'
  • every_6_months -> Only when 'run_frequently=False'
  • yearly -> Only when 'run_frequently=False'

monthly_week list[str], optional
If run_frequently=True and repeat='monthly', specifies the weeks the task should run, e.g., ['first', 'third']. Defaults to [].

start_time_h int, optional
Hour at which the task should start. Defaults to 0.

start_time_m int, optional
Minute at which the task should start. Defaults to 0.

same_day_repeat_h int, optional
Number of hours between repeated executions on the same day (run every x hours), if "Continue running within the same day" is desired.
Set to 0 to disable same-day repeats. Defaults to 0.
Possible values: 0..23

info

The args same_day_repeat_h and same_day_repeat_m cannot be used at the same time, if both are passed, same_day_repeat_h will be prioritized.

same_day_repeat_m int, optional
Number of minutes between repeated executions on the same day (run every x minutes), if "Continue running within the same day" is desired.
Set to 0 to disable same-day repeats. Defaults to 0.
Posible values: 1, 5, 10, 15, 20, 30

info

The args same_day_repeat_h and same_day_repeat_m cannot be used at the same time, if both are passed, same_day_repeat_h will be prioritized.

same_day_repeat_until int, optional
Last hour of the day when the task can repeat. Defaults to start_time_h.

Returns

dict[str, object]
A dictionary with the id of the created task.

Example return

Click to expand
{
"data": {
"id": 20
},
"success": true
}

create_recycle_bin_task

Create a new Recycle Bin Control task with the provided schedule and services to start/stop.

Internal API

SYNO.Core.TaskScheduler

Parameters

task_name str
The name of the task.

owner str
The task owner.

clean_all_shares bool
Whether the task should empty the recycle bins of all shares or not, if set to False, shares must be specified.

shares list[str]
List of shares of which to clean the recycle bins. Pass only the name of the shares without slashes, e.g. shares=['photo', 'web']. Defaults to [].

policy (dict) ``
Determines what files will be deleted from the recycle bins.
Possible values are:

  • {"policy": "clean_all"} -> Clean all files
  • {"policy": "time", "time": int} -> Clean all files older than X days, days being possed as value for "time" key.
  • {"policy": "size", "size": int , "sort_type": int} -> Clean files until recycle bin size reaches given "size" in MB, delete files by "sort_type".
    Possible values for "sort_type" are:
  • 0 -> Delete bigger files first
  • 1 -> Delete older files first

enable bool, optional
Whether the task should be enabled upon creation. Defaults to True.

run_frequently bool, optional
Determines whether the task runs on a recurring schedule (True) or only on a specific date (False). Defaults to True.

run_days str, optional
Days of the week when the task should run, used if run_frequently is set to True, specified as a comma-separated list (e.g., '0,1,2' for Sunday, Monday, Tuesday). Defaults to '0,1,2,3,4,5,6' (Daily).

run_date str, optional
The specific date the task should run, used if run_frequently is set to False. Format: yyyy/m/d (no prefix zeros). Defaults to "".

repeat str, optional
How often the task should repeat. Defaults to 'daily'.
Possible values:

  • daily -> Only when 'run_frequently=True'
  • weekly -> Only when 'run_frequently=True'
  • monthly -> Works for both 'run_frequently=True' and 'run_frequently=False'
  • no_repeat -> Only when 'run_frequently=False'
  • every_3_months -> Only when 'run_frequently=False'
  • every_6_months -> Only when 'run_frequently=False'
  • yearly -> Only when 'run_frequently=False'

monthly_week list[str], optional
If run_frequently=True and repeat='monthly', specifies the weeks the task should run, e.g., ['first', 'third'].
Defaults to [].

start_time_h int, optional
Hour at which the task should start. Defaults to 0.

start_time_m int, optional
Minute at which the task should start. Defaults to 0.

same_day_repeat_h int, optional
Number of hours between repeated executions on the same day (run every x hours), if "Continue running within the same day" is desired.
Set to 0 to disable same-day repeats. Defaults to 0 (disable same day repeat).
Possible values: 0..23

info

The args same_day_repeat_h and same_day_repeat_m cannot be used at the same time, if both are passed, same_day_repeat_h will be prioritized.

same_day_repeat_m int, optional
Number of minutes between repeated executions on the same day (run every x minutes), if "Continue running within the same day" is desired.
Set to 0 to disable same-day repeats. Defaults to 0 (disable same day repeat).
Posible values: 1, 5, 10, 15, 20, 30

info

The args same_day_repeat_h and same_day_repeat_m cannot be used at the same time, if both are passed, same_day_repeat_h will be prioritized.

same_day_repeat_until int, optional
Last hour of the day when the task can repeat. Defaults to start_time_h.

Returns

dict[str, object]
A dictionary with the id of the created task.

Example return

Click to expand
{
"data": {
"id": 20
},
"success": true
}

modify_recycle_bin_task

Modify settings of a Recycle Bin Control task.

warning

This method overwrites all the settings of the task, so if you only want to change one setting, you can fetch the current task configuration with get_task_config() and pass all the settings to this method.

Internal API

SYNO.Core.TaskScheduler

Parameters

task_id int
The ID of the task.

task_name str
The name of the task.

real_owner str
The task real owner, usually it is root, you can double check from the result of get_task_config().

clean_all_shares bool
Whether the task should empty the recycle bins of all shares or not, if set to False, shares must be specified.

shares list[str]
List of shares of which to clean the recycle bins. Pass only the name of the shares without slashes, e.g. shares=['photo', 'web']. Defaults to [].

policy (dict) ``
Determines what files will be deleted from the recycle bins.
Possible values are:

  • {"policy": "clean_all"} -> Clean all files
  • {"policy": "time", "time": int} -> Clean all files older than X days, days being possed as value for "time" key.
  • {"policy": "size", "size": int , "sort_type": int} -> Clean files until recycle bin size reaches given "size" in MB, delete files by "sort_type".
    Possible values for "sort_type" are:
  • 0 -> Delete bigger files first
  • 1 -> Delete older files first

enable bool, optional
Whether the task should be enabled upon creation. Defaults to True.

run_frequently bool, optional
Determines whether the task runs on a recurring schedule (True) or only on a specific date (False). Defaults to True.

run_days str, optional
Days of the week when the task should run, used if run_frequently is set to True, specified as a comma-separated list (e.g., '0,1,2' for Sunday, Monday, Tuesday). Defaults to '0,1,2,3,4,5,6' (Daily).

run_date str, optional
The specific date the task should run, used if run_frequently is set to False. Format: yyyy/m/d (no prefix zeros). Defaults to "".

repeat str, optional
How often the task should repeat. Defaults to 'daily'.
Possible values:

  • daily -> Only when 'run_frequently=True'
  • weekly -> Only when 'run_frequently=True'
  • monthly -> Works for both 'run_frequently=True' and 'run_frequently=False'
  • no_repeat -> Only when 'run_frequently=False'
  • every_3_months -> Only when 'run_frequently=False'
  • every_6_months -> Only when 'run_frequently=False'
  • yearly -> Only when 'run_frequently=False'

monthly_week list[str], optional
If run_frequently=True and repeat='monthly', specifies the weeks the task should run, e.g., ['first', 'third'].
Defaults to [].

start_time_h int, optional
Hour at which the task should start. Defaults to 0.

start_time_m int, optional
Minute at which the task should start. Defaults to 0.

same_day_repeat_h int, optional
Number of hours between repeated executions on the same day (run every x hours), if "Continue running within the same day" is desired.
Set to 0 to disable same-day repeats. Defaults to 0 (disable same day repeat).
Possible values: 0..23

info

The args same_day_repeat_h and same_day_repeat_m cannot be used at the same time, if both are passed, same_day_repeat_h will be prioritized.

same_day_repeat_m int, optional
Number of minutes between repeated executions on the same day (run every x minutes), if "Continue running within the same day" is desired.
Set to 0 to disable same-day repeats. Defaults to 0 (disable same day repeat).
Posible values: 1, 5, 10, 15, 20, 30

info

The args same_day_repeat_h and same_day_repeat_m cannot be used at the same time, if both are passed, same_day_repeat_h will be prioritized.

same_day_repeat_until int, optional
Last hour of the day when the task can repeat. Defaults to start_time_h.

Returns

dict[str, object]
A dictionary with the id of the created task.

Example return

Click to expand
{
"data": {
"id": 20
},
"success": true
}