Dumb Panel Task CLI
Create, edit, delete and toggle Dumb Panel cron tasks via its HTTP API, when ddp.exe has no command or a daidai.db edit won't load.
Dumb Panel Task CRUD
Tasks live in the tasks table of Dumb-Panel/daidai.db. ddp.exe only ships
task list / logs / run / stop — there is no add, update or delete. Two ways to change
tasks remain: the panel's own Web API (preferred, takes effect immediately), or writing
SQLite directly (requires an Administrator service restart).
Always prefer the API. On POST, PUT and DELETE /api/tasks the server updates the
in-memory scheduler alongside the database, so no elevation and no restart are needed.
Which route to take
- Just listing, reading logs or triggering a run →
ddp.exe task list|logs|run|stop. - Creating, renaming, changing a cron expression or command, enabling, disabling or
deleting →
scripts/ddp_task_api.pyfrom this skill. - Direct
daidai.dbedits are only justified when the backend is stopped or during a bulk migration. AfterwardsRestart-Service DumbPanel -Force(Administrator) is required, otherwise the service keeps its stale in-memory task table. - After any change, verify with
next_run_at(see below).
Quick start
The script finds the panel root by walking up from its own location and the working
directory, looking for Dumb-Panel/.jwt_secret. Override with --panel-root or the
DAIDAI_PANEL_ROOT environment variable.
S="scripts/ddp_task_api.py"
python "$S" list
python "$S" get 18
python "$S" raw GET /tasks/groups
Authentication is handled locally: the script reads Dumb-Panel/.jwt_secret and an
unexpired row from user_sessions, then signs a short-lived HS256 access JWT. The key,
jti and token are never printed or persisted. At least one valid web login session must
exist — sign in through the web UI once if not.
Create
python "$S" create --name "nightly backup" \
--command "task backups/run.py" \
--cron "15 3 * * *" --delay 300
--commandis alwaystask <path relative to Dumb-Panel/scripts/>; create the script file first.--delaymaps torandom_delay_seconds.- Add
--disabledto create an already-disabled task. This is implemented as a second call to the disable endpoint, becausePOST /tasksignoresstatusandenabled. - Use
--json '{"timeout":900}'(or--json @payload.json) for extra or override fields. Defaults such as notification channel 1, Python 3.12,env_scope=allandsuccess_exit_codes="0"are inDEFAULT_TASK; the full field list is inreferences/api_reference.md.
Update, toggle, run
python "$S" update 18 --patch '{"cron_expression":"20 3 * * *","name":"nightly backup"}'
python "$S" disable 18
python "$S" enable 18
python "$S" run 18
python "$S" stop 18
By default update does GET → strip read-only fields → merge patch → PUT, so no
configuration is silently cleared. --patch-only sends only the patch and should only be
used on builds known to accept partial bodies.
Delete
python "$S" delete 19 --yes
Only the task record is removed, never the script file. Do not add delete_script=1 to a
DELETE request. --yes is an intentional second confirmation; run get <id> first.
Verify that a change took effect
python "$S" get 18 | python -c "import json,sys; print(json.load(sys.stdin).get('next_run_at'))"
- A value such as
2027-01-02T00:00:00+08:00means the scheduler has picked the job up; the change is live, no restart needed. - Empty or
nullmeans the row exists but was never loaded — usually a direct DB edit. ddp.exe task run <ID>is useful for a smoke test, but it starts a separate scheduler in the current user session. It does not prove the service account can run the job.
Constraints and gotchas
POST /api/tasksignoresstatus/enabled: every new task starts enabled. Disable it afterwards viaPUT /tasks/:id/disable.POST /api/tasksalso ignoressort_order/list_order(both become 0). Ordering is done throughPUT /tasks/sortand does not affect execution.ddp.exe task runmay trigger local application-blacklist alerts forwmic.exe,reg.exeandsc.exe. Execution is unaffected and the exit code stays 0; do not retry or work around the alerts.- The service injects
TZ=Asia/Shanghai; Windows Python parses that as a POSIX TZ and ends up seven hours off. Panel-run Python scripts should setos.environ["TZ"] = "CST-8"at the top. - The service runs as
LocalSystem, which cannot read the current user'sAPPDATA. Scripts relying on per-user credentials need their own file fallback. ddp.exe statusreporting no runningdaidai-serverprocess is a Session 0 visibility artefact; trust the backend health endpoint.- Never place
.jwt_secret,daidai.db, a signed token or any credential value into documentation or a repository. Describe locations and procedures only.
Resources
scripts/ddp_task_api.py— authentication plus the CRUD CLI:list,get,create,update,delete,run,enable,disable,stop,raw.references/api_reference.md— endpoint table, task fields, JWT claims, read-only fields to strip on PUT, and an error/symptom reference. Load it when investigating an unfamiliar endpoint or a failing request.
- Downloads
- 102All time
- Security audit
- Review
- Last updated
- 2w ago
- Current version
- v1.0.0
- License
- MIT-0
