Schedulers
Unix (cron)
chico.schedulers.unix
Unix cron scheduler backend for chico.
Uses crontab to install, remove, and query a recurring entry that
runs chico sync automatically on macOS and Linux.
Supports intervals of 1–59 minutes (the cron minute field range). For longer intervals use the Windows Task Scheduler backend instead.
Example usage::
from chico.schedulers.unix import install, uninstall, is_installed, query
install(interval_minutes=30)
print(is_installed()) # True
print(query()) # {"Schedule": "*/30 * * * *", "Command": "..."}
uninstall()
SchedulerError
install(interval_minutes, command=None)
Add or update the chico sync cron entry.
Removes any existing chico entry before adding the new one, so this is safe to call repeatedly or to change the interval.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
interval_minutes
|
int
|
How often to run, in minutes. Must be between 1 and 59. |
required |
command
|
str | None
|
The shell command to schedule. Defaults to |
None
|
Raises:
| Type | Description |
|---|---|
SchedulerError
|
If the interval is out of range or |
Source code in chico/schedulers/unix.py
is_installed()
query()
Return the schedule and command from the chico cron entry.
Returns None if no entry is installed.
Source code in chico/schedulers/unix.py
uninstall()
Remove the chico sync cron entry.
Raises:
| Type | Description |
|---|---|
SchedulerError
|
If no chico entry exists or |
Source code in chico/schedulers/unix.py
Windows (Task Scheduler)
chico.schedulers.windows
Windows Task Scheduler backend for chico.
Uses schtasks.exe to create, remove, and query a recurring task that
runs chico sync automatically.
Example usage::
from chico.schedulers.windows import install, uninstall, is_installed, query
install(interval_minutes=30)
print(is_installed()) # True
print(query()) # {"Status": "Ready", "Last Run Time": "...", ...}
uninstall()
SchedulerError
install(interval_minutes, command=None)
Create or update the ChicoSync scheduled task.
Schedules python -m chico sync to run every interval_minutes
minutes for the current user. Safe to call when the task already exists
— the /F flag silently overwrites it.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
interval_minutes
|
int
|
How often to run, in minutes. Must be between 1 and 1439. |
required |
command
|
str | None
|
The shell command to schedule. Defaults to |
None
|
Raises:
| Type | Description |
|---|---|
SchedulerError
|
If |
Source code in chico/schedulers/windows.py
is_installed()
query()
Return key fields from the ChicoSync task, or None if not installed.
Parses the schtasks /Query /FO LIST /V output into a dict. Only the
fields listed in :data:_STATUS_FIELDS are included.
Source code in chico/schedulers/windows.py
uninstall()
Delete the ChicoSync scheduled task.
Raises:
| Type | Description |
|---|---|
SchedulerError
|
If |