Get your free beta license ↗
Panel and server · cron

A job works at the shell but fails on schedule

Last updated 30 Nov 2026
Summary

A command works at the shell but does nothing when cron runs it, and no email arrives. Use full paths to work around the short PATH and a log file to capture the output UrbeStack discards by default.

Symptoms

The job runs at its scheduled time, but its work is left undone. No email with the job's output arrives.

Cause

Cron runs each customer's job in its own environment, which includes these settings.

Output
SHELL=/bin/sh
HOME=/home/USER/files
PATH=/usr/bin:/bin:/usr/sbin:/sbin

The PATH omits /usr/local/bin, so cron cannot find commands installed there, such as composer or wp.

UrbeStack puts MAILTO="" on the first line of each crontab it writes. The job's output and errors are discarded.

A plain php command in a job runs independently of the site's PHP version. Each version has its own binary, such as /usr/bin/php8.4 on Ubuntu or /opt/remi/php84/root/usr/bin/php on AlmaLinux.

Resolution

  1. Use the full path for each command in the job and send its output to a file in the customer's home directory. This example adds a job that runs every five minutes. The UrbeStack command reads the job's command from standard input.

    echo '/usr/bin/php8.4 /home/USER/files/web/example.com/public_html/cron.php >> /home/USER/files/cron.log 2>&1' | urbestack-cron-job-add --user USER --schedule '*/5 * * * *' --command-stdin
  2. Read /home/USER/files/cron.log after the next run. If the job still fails, check the customer's crontab as cron reads it.

    crontab -u USER -l