Skip to content

Knowledgebase

Creating and testing a DirectAdmin cron job

control-panels, development

A DirectAdmin cron job runs a command under the hosting user on a defined schedule. It needs the correct runtime and paths, and it should not overlap with another scheduler performing the same work. A job that succeeds in an interactive shell can fail in cron because the environment differs.

Check access and requirements

Obtain the exact command and interval from the application documentation. Confirm the account is permitted to use cron, identify the server timezone and record the intended PHP or other runtime path. Choose a safe test that will not duplicate payments, messages or imports.

01 Create and test a DirectAdmin cron job

  1. At user level, open Advanced Features > Cron Jobs and create a job.
  2. Set minute, hour, day, month and weekday fields deliberately, using the interface examples to review the resulting schedule. Avoid unnecessarily frequent polling.
  3. Enter the documented command with explicit paths and correct quoting. Do not place a secret directly in a command where it will be exposed in process listings or logs if the application offers protected configuration.
  4. Choose a monitored output destination and ensure output does not contain private customer data. Save the job once and check for duplicate entries.
  5. Observe one planned execution. If testing as the hosting user through an administrator shell, match the cron environment and permissions rather than running the job as root.

How do I confirm the cron job completed correctly?

Check the application outcome, exit result and relevant log. Confirm the runtime version and working directory used by the job. For longer tasks, use application-supported locking so a new run does not overlap an unfinished one.

Resolve setup problems

For command-not-found errors, correct the runtime path. For permission failures, inspect the specific file and user rather than making everything writable. If the job causes harm, disable it and preserve the configuration before investigating. Removing the schedule does not automatically terminate a process already running.

Was this answer helpful?

Need a little more help?

Our support team can help you find the next step.

Contact support