Wheelhouse docs

Run something on a schedule#

You will end up with a script the router runs on an interval or at a time you choose, and that survives an image upgrade. VyOS' own task scheduler does the running; System → Settings has an editor for it, and the whole thing is three lines of configuration.

Before you start#

  • The operator role and a licence, or console access.
  • The script, and somewhere for it to live. Put it in /config/scripts. /config is the persistent partition, so anything there survives an image upgrade; /usr and /opt come from the image and are replaced.

Step 1 — Write the script#

bash
sudo mkdir -p /config/scripts
sudoedit /config/scripts/nightly-check.sh
sudo chmod 755 /config/scripts/nightly-check.sh
/config/scripts/nightly-check.sh
#!/bin/sh
set -eu
# Anything that reads the operational CLI non-interactively needs the wrapper.
/opt/vyatta/bin/vyatta-op-cmd-wrapper show configuration commands > /tmp/live
logger -t nightly-check "configuration has $(wc -l < /tmp/live) lines"

logger puts the output in the journal, which is where you will look for it — the Logs page reads the same journal.

Step 2 — Schedule it#

In the UI: System → Settings → Scheduled tasks. Give it a name, choose interval or crontab, and give it the path.

As commands, on an interval:

set system task-scheduler task nightly-check interval 1h
set system task-scheduler task nightly-check executable path /config/scripts/nightly-check.sh

As commands, at a time:

set system task-scheduler task nightly-check crontab-spec '15 3 * * *'
set system task-scheduler task nightly-check executable path /config/scripts/nightly-check.sh

With arguments:

set system task-scheduler task nightly-check executable arguments '--verbose /config/scripts/input'

The editor stages exactly those lines, and shows them before it does.

Step 3 — Commit and wait#

The Commit Bar applies it like any other change. A task with an interval runs first after that interval, not immediately, so a task on 24h tells you nothing until tomorrow — use a short interval to test and lengthen it afterwards.

Check it worked#

bash
# Did it run, and what did it say?
journalctl -t nightly-check --since -1h

# Is it declared?
show configuration commands | match task-scheduler

In the UI, Logs filtered on the tag you used in logger.

Things that will bite#

The script runs as root. Everything in /config/scripts should be readable only by root if it holds anything sensitive, and chmod 700 is the safe default for one that carries a credential.

Output goes nowhere unless you send it somewhere. A task that prints to standard output prints into the void. Use logger, or redirect to a file under /config.

A failing task is silent. Nothing alerts on a non-zero exit. If the task matters, make it log its own failure, and watch for that line — Ship logs off the box is how you get that off the router.

/tmp is not persistent. Fine for scratch, no use for state.

What this is not for#

  • Backups. There is no backup target on the router, and a backup written to the disk you are protecting is a snapshot, not a backup. Run the backup from another machine — Take a backup that is actually complete.
  • Committing configuration on a timer. That is the reconcile loop, which has commit-confirm behind it and audits what it does.

Undoing it#

delete system task-scheduler task nightly-check

The script file stays where it is; delete it separately if you want it gone.

See also#


Checked against ui/src/pages/SystemSettings.tsx · docs/upgrade.md · docs/backup-restore.md

Updated 2026-09-02 scheduler cron operations