# Manage cron jobs
Source: https://docs.webgee.com/en/hosting/managing-cron-jobs-in-cpanel







Schedule a command to run automatically. Applies to shared, reseller and Premium
hosting.

## Add one [#add-one]

1. In cPanel, open **Cron Jobs** under **Advanced**.

   <img alt="The Cron Jobs page, showing the Cron Email setting" src="__img0" />

2. Use **Common Settings** to pick a preset interval, or set **Minute**,
   **Hour**, **Day**, **Month** and **Weekday** yourself.

   <img alt="The Add New Cron Job form with the interval fields and PHP command examples" src="__img1" />

3. Enter the command.

4. Select **Add New Cron Job**.

A typical command:

```bash
cd /home/cpaneluser/public_html && /usr/local/bin/php -q script.php > /dev/null 2>&1
```

## Choose the interval carefully [#choose-the-interval-carefully]

<Callout type="warn">
  A heavy job on a short interval is one of the most common ways to exhaust your
  account's resources. Each run consumes CPU and an
  [entry process](/en/performance/entry-processes-ep-what-is-an-entry-process),
  and if a job takes longer than its interval, runs overlap and stack up until
  the account hits its limits.

  Sustained overuse also breaches the fair usage policy.
</Callout>

Rules of thumb:

* **Every 5 minutes** is the shortest sensible interval for most work.
* **Every minute** only for something that reliably finishes in seconds.
* **Time the job first** — `time php script.php` — and keep the interval
  comfortably longer than the result.

## Stop the emails [#stop-the-emails]

By default cron emails you the output of **every run**. A job running every five
minutes produces nearly 300 emails a day.

Set the **Cron Email** field to an address you want them at — or better, discard
the output in the command itself:

```bash
# Discard everything
command > /dev/null 2>&1

# Keep errors, discard normal output
command > /dev/null
```

The second is usually right: silence when it works, an email when it does not.

See [Stop cron emails](/en/hosting/how-do-i-stop-suppress-cron-emails-from-being-sent-or-logged).

## Check it worked [#check-it-worked]

Set the job to run a minute or two ahead and watch for the result — the email if
you kept it, or the effect of the job itself.

To confirm the command works at all, run it over SSH first exactly as written.
Most failed cron jobs are wrong paths, and cron gives you no clue: it simply
produces nothing.

## Common problems [#common-problems]

* **Wrong path.** cPanel does not validate the command. Use absolute paths —
  `/usr/local/bin/php`, not `php`.
* **Different environment.** Cron runs with a minimal `PATH` and none of your
  shell configuration. A command that works interactively may not.
* **Overlapping runs.** If a job can take longer than its interval, guard it with
  a lock file.

## WordPress [#wordpress]

Do not schedule `wp-cron.php` every minute. Five minutes is right, and WP-Cron
must be disabled in `wp-config.php` first or both will run — see
[Replace WP-Cron with a real cron job](/en/hosting/wordpress/enhancing-wordpress-performance-disabling-wp-cron-for-faster-load-times).

## Related [#related]

* [Stop cron emails](/en/hosting/how-do-i-stop-suppress-cron-emails-from-being-sent-or-logged)
* [What entry processes are](/en/performance/entry-processes-ep-what-is-an-entry-process)
