Cron Jobs

Last updated

/jabali-panel/cron. Scheduled commands that run under your account.

Adding a cron job

Click Add cron job, supply:

  • Name: operator label.
  • Schedule: 5-field cron (min hour day month dow). Examples: 0 3 * * * (daily at 03:00), */15 * * * * (every 15 minutes), 0 0 1 * * (first day of each month at midnight).
  • Command: must be on the allowlist (see below).

On save, the agent creates two systemd-user units in your home:

  • ~/.config/systemd/user/jabali-cron-<id>.service, the command.
  • ~/.config/systemd/user/jabali-cron-<id>.timer, the schedule.

Both are owned by you. The first time you add a cron job, systemd lingering is enabled for your account (loginctl enable-linger <your-username>) so timers fire even when you are not actively logged in.

Command allowlist

The panel does not allow arbitrary shell commands. Cron jobs run as your user, inside the same sandbox as your SSH shell, and each command must be one of a fixed set of interpreters running a file you own, with no shell features (no cd, $HOME, |, ;, &&, backticks, redirects, or globbing). Use absolute paths instead of cd/$HOME.

The allowlist:

  • wp (WP-CLI) — requires --path=<absolute-docroot> instead of cd. Example: wp --path=/home/USER/domains/example.com/public_html cron event run --due-now wp runs on your account’s CLI default PHP version (PHP Settings → CLI / Terminal default PHP version), not on the site’s version. To run WP-CLI on a specific version, start the line with that PHP and wp-cli’s full path: php7.4 /usr/local/bin/wp --path=/home/USER/domains/example.com/public_html cron event run --due-now
  • php (or a pinned version, e.g. php8.3) — runs an absolute .php file inside one of your docroots. Inline code (-r, -R, -B, -E) is not allowed.
  • python / python3 / a pinned version (e.g. python3.11), or the absolute path to a virtualenv interpreter — runs an absolute .py file inside your account (home or a docroot). Inline/module execution (-c, -m, reading from stdin) is not allowed. Django example: python3 /home/USER/site/manage.py runjobs or, with a venv, /home/USER/venv/bin/python /home/USER/site/manage.py migrate — note there is no cd; give manage.py’s absolute path.
  • node / nodejs (or an absolute path to one, e.g. an nvm build) — runs an absolute .js / .mjs / .cjs file inside your account. Inline code (-e, --eval, -p, --print) is not allowed.
  • curl / wget — a plain GET to one of your own domains (a self-domain HTTP trigger; the panel pins the target and hardens the request).
  • bash / sh — only when your hosting plan includes SSH access. Runs an absolute .sh file inside your account (home or a docroot), with optional arguments after it: bash /home/USER/bin/backup.sh or sh /home/USER/bin/backup.sh nightly. The script’s path alone (/home/USER/bin/backup.sh) runs it with bash. No option may come before the script (bash -c … is refused). Inside the script every shell feature works, cd, pipes and && included, because the job runs in the same sandbox as your SSH shell. Without SSH access in your plan the panel refuses the job (“Shell scripts need SSH access in the account’s hosting plan, and never run as root”).

A job may hold several commands, one per line — they run in order and stop if one fails. Blank lines and # comments (including a #!/bin/bash shebang line) are ignored, so you can paste a script’s body, but every executable line must still match the allowlist above.

If your plan loses SSH access, a job that runs a shell script stops: its timer is removed within a minute, and the job can’t be turned on, edited or run until SSH access is back. It stays in the list as it was, so it runs again on its schedule once your plan includes SSH again. The account’s other jobs are not affected.

Sandboxing

Cron commands run inside the same per-user sandbox as your SSH shell — a read-only system, an isolated process view, and only your own home and docroots visible. Your scripts run normally (your files, your database, the network all work); what’s hidden is the host’s internals (other tenants, server config), which a cron never needs. This is why a script can’t reach outside your account even if it shells out.

Working directory

A job runs in your home directory (/home/<you>), not in the folder of the script it runs. php8.3 /home/<you>/domains/example.com/public_html/task.php from cron therefore behaves differently from php8.3 task.php typed inside that folder when the script uses relative paths. For example, file_put_contents('cache/state.json', …) looks for cache/ under your home, not next to the script. Build paths from __DIR__, or call chdir(__DIR__); at the top of the script.

Why systemd-user, not crontab

  • Per-job journal logs (journalctl --user -u jabali-cron-<id>).
  • RandomizedDelaySec= provides natural jitter without adding sleep $RANDOM to your command.
  • You do not need an interactive shell to manage your cron jobs (and you do not have one).

Editing and deleting

Per-row Edit changes the schedule or command. Delete removes both unit files; the reconciler converges within 60 seconds.

Running on demand

Per-row Run now runs the job once, immediately, through its own service unit, the same way the timer does. Useful for testing a new cron job without waiting for the next scheduled fire.

The panel waits up to 20 seconds and shows the exit code and the output. The output includes both stdout and stderr. A job still running after that keeps running in the background: the panel says so, the output goes to the job’s log, and Last Run updates within a minute of the job finishing. A job that is already running, from its schedule or an earlier Run now, is not started a second time.

Right after you create a job, before the panel has installed its timer (within a minute), Run now runs the command directly instead, and stops it after about 25 seconds.

Common cron patterns

  • WordPress: wp cron event run --due-now --url=https://example.com every 15 minutes (replaces WP’s built-in pseudo-cron, which fires only on page hits).
  • Maintenance: a custom PHP script to clean up old uploads daily.
  • Backups: a mysqldump to your own off-site target (this is on top of the panel’s account_full backups).

Failure handling

The panel does not send a notification when a cron job fails. Open the job’s log to see its output.