# A job works at the shell but fails on schedule

UrbeStack sysadmin note about cron. Last updated 30 Nov 2026.

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

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
```

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
```

If the problem persists after you follow this note, you can [open a support ticket](https://support.urbestack.com/new?type=support). Including the output of the commands you ran helps support diagnose the problem.
