Skip to main content

Scheduler

The Scheduler helps you automate recurring admin work on your server.

Instead of running changes manually every day or every week, you can create tasks once and let dzbot run them at the right time.

What you can automateโ€‹

The Scheduler currently supports three categories:

Server tasksโ€‹

  • Server Restart: queue a restart at a planned time.
  • Vehicle Wipe: prepare a vehicle wipe cycle. The task offers Also wipe ordered vehicles โ€” off by default. Vehicles from spawn subscriptions โ€” the way the shop sells vehicles โ€” are written into events.xml as ignore, which is what normally carries them through a wipe; ticking the box takes them with it as well.
  • Change server settings: apply selected setting changes automatically.

Mods tasksโ€‹

  • Install/uninstall mods: switch mod configurations on or off.
  • Change mod configuration: update selected config fields on a mod setup.

Actions tasksโ€‹

  • Run action: run one of your actions โ€” installed from the marketplace or your own โ€” with its settings.
  • Enable/disable action: switch an action on or off.
  • Change action configuration: update selected action config values.
  • Custom Action: write a Lua script that runs directly on the schedule you define.

Run actionโ€‹

Runs an action at the times of the task, with the values set in the action's form. The list offers the actions whose trigger is Scheduled (scheduled actions) โ€” install one from the marketplace, such as Group Wage, or create your own with that trigger. Every run shows up in the task log and in the action's own run log, with what the script printed.

  • A disabled action is skipped: the task log says so, and a recurring task moves on to its next run (a one-off task is cancelled). No Discord notification goes out for a skipped run.
  • A deleted action makes the task fail, with a notification if you set one up. Choose another action to fix it.
  • If the action fails, the task fails too, and the error is shown on the task.
  • Choosing the action takes the right to edit actions (actions.edit) on top of the scheduler right. Somebody with only the scheduler right can still change the schedule of the task, pause it or run it now.

Custom Actionโ€‹

Custom Action tasks let you write arbitrary Lua code that is executed on a schedule โ€” without being tied to a specific log event. The script has access to all action functions (discord, server, player, faction, math) but does not receive data or config globals since there is no event context and no configuration schema. When the script needs settings that staff can change without touching code, write it as an action with the trigger Scheduled and run it with a Run action task instead.

This is useful for recurring maintenance work, for example:

  • Paying out daily or weekly rewards to all players in a group
  • Sending scheduled announcements to a Discord channel
  • Applying balance changes based on faction membership or activity
-- Example: weekly salary for all active faction members
local members = player.list({ faction = true, last_online_after = "-7d" });

for _, p in ipairs(members) do
player.change_balance(p.username, 500, "Weekly faction salary");
end

Use print() inside your script to write debug output to the task log.

For a regular wage to a dzbot group without writing code, install the ready-made Group Wage action from the action marketplace instead and run it with a Run action task. It never pays a member twice for the same day, week or month.

Run modes and schedule optionsโ€‹

Each task can be created in one of two run modes:

  • Run once: executes one time at the exact date/time you choose.
  • Recurring: keeps running on a repeating schedule.

Recurring schedules support:

  • Hourly
  • Daily (one or multiple times per day)
  • Weekly (selected weekdays, optional interval in weeks)
  • Monthly by day of month
  • Monthly by weekday (for example, first Monday or last Friday)

You can also set an optional start date to delay when a recurring schedule becomes active.

How the scheduler behavesโ€‹

  • Tasks can be paused. Paused tasks are skipped until unpaused.
  • Run now immediately queues a task and unpauses it.
  • Recurring tasks are automatically moved to the next run after success.
  • One-time tasks finish after one execution.
  • You can duplicate a task to reuse the same setup quickly.
  • Each task has a log history so you can review what happened.

Statuses you will seeโ€‹

  • Pending: waiting for execution.
  • Running: currently in progress.
  • Succeeded: finished successfully.
  • Failed: finished with an error.
  • Canceled: stopped because no valid next schedule could be calculated, or a one-off task that had nothing to do (server suspended, action disabled).
  • Paused: manually paused by an admin.

Finding a taskโ€‹

The task list has a search field (description and task type) and filters by status, category, task type and paused. Paused tasks come last; the others are ordered by their next run.

Timezone handlingโ€‹

The scheduler uses your server timezone from Settings.

If run times look off, check the server timezone first, then verify the task's scheduled time.

Discord notificationsโ€‹

Each task can send a message to Discord after it runs.

To use this:

  1. Make sure your Discord bot is installed on the server.
  2. Enable Discord notification in the task.
  3. Select a Discord text channel.
  4. Add a notification message.

Optional: enable Only notify on success if you want the message only to be send when the task succeeded.

  1. Start with one clear, narrow task (for example weekly restart).
  2. Save it as paused and double-check schedule/timezone.
  3. Use Run now once to validate behavior.
  4. Review logs and adjust if needed.
  5. Unpause when you are ready for full automation.

Good operational practicesโ€‹

  • Keep task descriptions clear so your team understands purpose and impact.
  • Test risky tasks (mod changes, action config changes) once manually before making them recurring.
  • Use duplicate when creating variants to avoid setup mistakes.
  • Review failed tasks regularly so automation stays reliable.

Operational checksโ€‹

If a task does not run, verify:

  • the task is not paused
  • the schedule/time is valid
  • the server timezone is configured correctly in the server settings

If Discord notifications are missing, verify:

  • bot installation and Discord connection on the server
  • a channel and message are set in the task
  • "Only notify on success" behavior (failed runs will not notify)