Cron job every 2 hours

To run a cron job every 2 hours, use 0 */2 * * *. Every 2 hours, on the hour.

  • Free
  • No Sign-Up
  • Runs in Your Browser

Runs

Next Runs

Your time zone
Sunday11 Oct 2026, 00:00
Sunday11 Oct 2026, 02:00
Sunday11 Oct 2026, 04:00
Sunday11 Oct 2026, 06:00
Sunday11 Oct 2026, 08:00

Crontab Line

0 */2 * * * /path/to/job.sh >> /var/log/cron-job.log 2>&1

Cron Expression Generator

0 */2 * * * explained

Expression0 */2 * * *
MeaningEvery 2 hours, on the hour
Runs per Week84
Crontab Line0 */2 * * * /path/to/job.sh
systemd OnCalendar00/2:00
Time ZoneThe server's, unless CRON_TZ is set

Steps like */2 line up with the clock, not with the moment you saved the crontab: */15 runs at :00, :15, :30 and :45 every hour. Cron has no way to say "15 minutes after the last run".

If a run can take longer than the gap between runs, stop runs overlapping with flock: 0 */2 * * * flock -n /tmp/job.lock /path/to/job.sh. A second copy then exits straight away instead of piling up.

Cron runs jobs with a minimal environment: use full paths, and send output to a log file (>> /var/log/job.log 2>&1) so errors are not lost.

Questions

How do I run a cron job every 2 hours?
Run crontab -e and add: 0 */2 * * * /path/to/job.sh
How do I check the cron job ran?
Look in the job's own log if it writes one, or the system log: grep CRON /var/log/syslog on Debian and Ubuntu, or journalctl -u cron (cron.service is crond on RHEL).
What is the systemd timer equivalent of 0 */2 * * *?
OnCalendar=00/2:00 in a .timer unit. systemd timers can also catch up on missed runs with Persistent=true.

Run servers for other people?

Frabs stops the abuse their VMs send out, and keeps your network off blocklists.