User

Creating Cron Jobs

Step-by-step guide to setting up a cron job in Opterius Hosting Mode.

Last updated 1775606400

Go to Hosting Mode → Cron Jobs → New Cron Job.

Fields

Command — The full shell command to run. Use absolute paths for all binaries and files (cron runs with a minimal environment and no guaranteed $PATH).

Good:

/usr/bin/php8.3 /home/username/domain.com/public_html/wp-cron.php

Bad (relative paths fail):

php wp-cron.php

Schedule — Use the schedule builder to pick a preset, or toggle to Custom and enter a raw crontab expression. See Understanding Cron for format reference.

Enabled — Toggle on or off. Disabled cron jobs are kept in your crontab as comments and do not run, but are preserved so you can re-enable them later without re-entering the command.

PHP Command Format

When running a PHP script, call the PHP binary explicitly with an absolute path:

/usr/bin/php8.3 /home/username/domain.com/public_html/script.php

To use a specific PHP version, call the versioned binary:

/usr/bin/php8.1 /home/username/domain.com/artisan schedule:run
/usr/bin/php8.4 /home/username/domain.com/public_html/cron.php

[!TIP] Check available PHP binaries on the server: ls /usr/bin/php*

Capturing Output

By default, cron output is discarded. To debug a failing cron job, redirect stdout and stderr to a log file:

/usr/bin/php8.3 /home/username/domain.com/artisan schedule:run >> /home/username/cron.log 2>&1

>> file appends stdout to the file. 2>&1 sends stderr to the same place. Check the log file via the File Manager or SSH.

[!NOTE] Log files grow indefinitely if left unchecked. Either pipe output to /dev/null once the job is confirmed working, or add a separate weekly cron to truncate the log file.

Enabling and Disabling Without Deleting

Toggle the Enabled switch on a cron job row in Hosting Mode → Cron Jobs. The agent comments out or restores the line in your crontab. The command and schedule are preserved.

This is useful for temporarily pausing a job (during a migration, for example) without losing the configuration.

Editing an Existing Cron Job

Click the edit icon on any cron job row. Update the command or schedule and click Save. The change is written to your crontab immediately.

Deleting a Cron Job

Click the delete icon on a cron job row and confirm. The entry is removed from your crontab permanently.

See Cron Job Examples for ready-to-use commands for common hosting tasks.