Creating a schedule#
The Schedules tab runs jobs for you on a cron timetable. A schedule fires at the times you set, then works through its list of tasks in order. It is the way to handle the routine work a server needs, like a nightly restart, a daily backup, or a warning broadcast a few minutes before either of those happens.
Click "New Schedule" to open the Create new schedule form. Give the schedule a name first, since that is how you will recognise it in the list later. The rest of the form is cron syntax, split across five fields that together describe when the schedule should run.
Minutedefaults to*/5, which means every five minutes.Houris the hour of the day on a 24 hour clock, from0to23.Day of weektakes0to6with Sunday as0, or three letter names likeMON.Day of monthis a calendar date from1to31.Monthis1to12, or names likeJAN.
Every field defaults to *, which matches any value, so a fresh schedule runs every five minutes until you narrow it down. Each field also accepts a list with ,, a range with -, and a step with /, so 8-12 in the hour field is every hour from 8am to noon, and */5 in the minute field is every fifth minute. The form shows the same examples and special characters in a cheat sheet beside the fields. A few common patterns:
*/5 * * * * runs every 5 minutes
0 */1 * * * runs once an hour
0 8-12 * * * runs hourly from 8am to noon
0 0 * * * runs once a day at midnight
0 0 * * MON runs every MondayIf an expression is hard to picture, the Crontab Guru link in the form helps you build one and read it back in plain English.
Two switches sit below the cron fields, and both default on. "Only When Server Is Online" skips the run when the server is stopped, which is what you want for a task that needs a live server. "Schedule Enabled" runs the schedule automatically on its timetable. Save with "Create schedule".
Adding tasks#
A schedule on its own does nothing until you give it tasks. Open the schedule and click "New Task" to add one. Tasks run in the order they appear, so the sequence you build them in is the sequence they fire in. Each task has an Action, and the three actions are these.
- Send command runs a line in the console, exactly as if you had typed it yourself. Put the command in the Payload box.
- Powersends a power action to the server. The Payload dropdown offers "Start the server", "Restart the server", "Stop the server", and "Terminate the server". Terminate is a hard kill rather than a clean shutdown, so reach for stop first and keep terminate for a server that has hung.
- Create backup saves a backup. You can leave the Ignored files box empty, in which case the contents of your
.pyroignorefile decides what stays out of the archive, or list extra files and folders here to exclude them from this task only.
Time offset and continue on failure#
Each task has a "Time offset (in seconds)" value, which is how long the schedule waits after the previous task finishes before it starts this one. The offset can be anywhere from 0 to 900 seconds. It is ignored for the first task in a schedule, since that one runs the moment the schedule fires. The offset is what lets you space tasks out, for example a warning command, then a sixty second wait, then a restart.
By default a schedule stops the moment a task fails, and every task after it is skipped. Turn on "Continue on Failure" for a task if you would rather the schedule carry on to the later tasks regardless of whether that one worked.
Run now, edit, and delete#
Once a schedule has at least one task, a "Run Now" button appears, and it fires the whole schedule straight away, outside its normal timetable. This is the quickest way to test that your tasks do what you expect. While a schedule is running it shows a Processing badge and the button is disabled, so you cannot stack two runs on top of each other.
"Edit" reopens the schedule form to change the name, cron fields, or switches, and each task has its own Edit and Delete buttons for changing the tasks themselves. "Delete" removes the whole schedule. The schedule page also shows the last run time and the next scheduled run, so you can confirm the timetable is behaving.
Who can create, edit, run, or delete schedules depends on a subuser's permissions, so a user without schedule access will not see these controls.
Things to watch for#
- Cron runs in the server's timezone. If yours differs, a notice in the form spells out the offset, for example that the server is a few hours ahead of you, so your times line up the way you meant.
- A backup task cannot be created when the server's backup limit is
0. When you are at the backup count limit, the oldest backup rotates out to make room for the new one. - Deleting a schedule removes all of its tasks and terminates any process it has running at the time.