Skip to content

Cron schedule

Cron job every 2 hours

The cron expression for every 2 hours is:

0 */2 * * *

What it does

Runs at 00:00, 02:00, 04:00 … 22:00: twelve times a day.

FieldValueMeaning
Minute0at minute 0
Hour*/2every 2 hours
Day of the month*every day of the month
Month*every month
Day of the week*every day of the week

Next run times

In your time zone. Change the expression to try another schedule.

Next runs

Examples

Crontab line

Add it with crontab -e over SSH. Replace the path with your script; the redirect keeps cron from emailing you the output.

0 */2 * * * /path/to/command >> /dev/null 2>&1

In Laravel

Define the task in routes/console.php (Laravel 11 and 12):

use Illuminate\Support\Facades\Schedule;

Schedule::command('reports:send')->everyTwoHours();

Then add the scheduler's single crontab entry once; it checks every task each minute:

* * * * * cd /path/to/your-app && php artisan schedule:run >> /dev/null 2>&1

In cPanel

  1. Open Cron Jobs under Advanced.
  2. Type the five fields: 0 */2 * * *.
  3. In Command, use the full path to PHP, for example /usr/local/bin/php /home/user/app/artisan schedule:run.
  4. Click Add New Cron Job. Some hosts limit how often cron may run; check your plan if it seems to skip runs.

Frequently asked questions

What does 0 */2 * * * mean in cron?

It runs every 2 hours. The five fields are minute, hour, day of the month, month and day of the week; the table above explains each one.

How do I run a Laravel task every 2 hours?

In routes/console.php: Schedule::command('your:command')->everyTwoHours(); and add the single crontab entry * * * * * cd /path/to/app && php artisan schedule:run >> /dev/null 2>&1.

Which time zone does cron use?

The server's time zone (check it with date in SSH, or ask your host). Laravel uses the timezone in config/app.php, and you can set it per task with ->timezone('Europe/London').

Get new articles in your inbox

Practical tutorials and deep dives, about once a week. No spam, unsubscribe anytime.

Privacy policy

Add DEV Talk to your Home Screen

  1. 1 Tap the Share button in Safari's toolbar.
  2. 2 Scroll down and tap Add to Home Screen.
  3. 3 Tap Add. Open it from the Home Screen to read like an app and to turn on notifications with the bell.

We use cookies to improve your experience and analyze traffic. By continuing, you agree to our Privacy Policy.