Scheduled Tasks

Use Scheduled Tasks to run shell commands on a recurring schedule — for example a nightly apt-get update, a weekly backup script, or any other cron-style job that lives at the server level rather than tied to a single project.

Scheduled jobs is a section of a server’s page, in its Run group.

Server-level vs. project-level #

There are two places to schedule things in Depfloy:

  • Server-level Scheduled Tasks (this page) — for OS-level commands, scripts that touch multiple projects, or anything not tied to a Laravel application. Depfloy writes these to the server’s crontab.
  • Project-level Schedulers (a project’s Scheduler section; see Project Schedulers) — for Laravel application schedules defined in your code. Depfloy reads them from your project.

Use the right tool for the job — schedule a Laravel artisan task at the project level, schedule a system-level housekeeping task on the server.

Add a scheduled task #

  1. Open the server’s Scheduled jobs section.
  2. Click Add Scheduled Job.
  3. Fill in:
    • Job Name — for your reference; appears in the list.
    • Command — the shell command to run.
    • Directory — working directory the command runs from. Defaults to the home directory of the user.
    • User — usually depfloy. Use root only when you need elevated privileges.
    • Frequency — Daily, Weekly, Monthly, or Custom.
    • Cron expression — only if you picked Custom. crontab.guru is a good helper.

Depfloy writes the job to the appropriate crontab and starts running it on schedule.

Add scheduled job

Manage existing tasks #

Each row in the Scheduled jobs list has actions for stop, start, pause, resume, restart, edit, and delete.

The same menu carries Turn on heartbeat, which watches the task and notifies you when a run is late or reports a failure. The expected interval comes from the task’s own schedule. See Uptime Monitoring.

Edit scheduled job