Run a cron job at reboot
@reboot
Check it below, then take the line for any of 17 schedulers.
Click to edit · paste a crontab line · hover a field for its values
Once, when the machine boots.
Nothing to watch out for on Debian / Ubuntu cron.
# crontab -e (runs on the server's clock: UTC) @reboot /path/to/command
· sudo runwisp takeover runs your crontab as it is · How RunWisp compares
Details
Upcoming runs At start-up
No clock involved: it runs once each time Debian / Ubuntu cron starts.
Calendar At start-up only
Between two dates
Daylight saving
Not tied to the wall clock, so clock changes don't move it.
When things go wrong Server off: Skipped
- Server was off
- Skipped. anacron only catches up cron.daily, weekly and monthly.
- Last run still going
- Starts another copy on top.
- A run fails
- Output is mailed if MAILTO and a mail server work. No output, no mail, whatever the exit code.
- Time zone
- The server's zone. TZ= in a crontab only reaches the command.
- Precision
- 1 minute.
Sources: manpages.debian.org,manpages.debian.org
Other schedulers As written in 2 of 16
- ✓ cronie
@rebootvs RunWisp - ✓ BusyBox crond
@reboot - ↻ systemd timer
OnBootSec=0systemd timer has no @reboot. vs RunWisp - ↻ RunWisp
run_on_start = "boot"RunWisp has no @reboot. - ✗ Kubernetes CronJob Kubernetes CronJob has no run-at-boot trigger.
- ✗ Ofelia Ofelia has no run-at-boot trigger. vs RunWisp
- ✗ Dagu Dagu has no run-at-boot trigger. vs RunWisp
- ✗ PM2 cron_restart PM2 cron_restart has no run-at-boot trigger. vs RunWisp
- ✗ Jobber Jobber has no run-at-boot trigger. vs RunWisp
- ✗ GitHub Actions GitHub Actions has no run-at-boot trigger.
- ✗ GitLab CI schedule GitLab CI schedule has no run-at-boot trigger.
- ✗ AWS EventBridge Scheduler AWS EventBridge Scheduler has no run-at-boot trigger.
- ✗ Google Cloud Scheduler Google Cloud Scheduler has no run-at-boot trigger.
- ✗ Jenkins Jenkins has no run-at-boot trigger.
- ✗ Quartz Quartz has no run-at-boot trigger.
- ✗ Spring @Scheduled Spring @Scheduled has no run-at-boot trigger.
✓ works as written · ↻ different syntax · ≠ runs at other times · ? not documented · ✗ can't
At reboot, in every scheduler
Works as written in 3 of 17. Times are UTC; the checker above takes any zone.
RunWisp writes it as run_on_start = "boot": once per machine boot, not again when the daemon restarts or updates.
| Scheduler | Line | Notes | |
|---|---|---|---|
| Debian / Ubuntu cron | ✓ | @reboot | Works as written. |
| cronie | ✓ | @reboot | Works as written. |
| BusyBox crond | ✓ | @reboot | Works as written. |
| systemd timer | ↻ | OnBootSec=0 | systemd timer has no @reboot. |
| RunWisp | ↻ | run_on_start = "boot" | RunWisp has no @reboot. |
| Kubernetes CronJob | ✗ | Kubernetes CronJob has no run-at-boot trigger. | |
| Ofelia | ✗ | Ofelia has no run-at-boot trigger. | |
| Dagu | ✗ | Dagu has no run-at-boot trigger. | |
| PM2 cron_restart | ✗ | PM2 cron_restart has no run-at-boot trigger. | |
| Jobber | ✗ | Jobber has no run-at-boot trigger. | |
| GitHub Actions | ✗ | GitHub Actions has no run-at-boot trigger. | |
| GitLab CI schedule | ✗ | GitLab CI schedule has no run-at-boot trigger. | |
| AWS EventBridge Scheduler | ✗ | AWS EventBridge Scheduler has no run-at-boot trigger. | |
| Google Cloud Scheduler | ✗ | Google Cloud Scheduler has no run-at-boot trigger. | |
| Jenkins | ✗ | Jenkins has no run-at-boot trigger. | |
| Quartz | ✗ | Quartz has no run-at-boot trigger. | |
| Spring @Scheduled | ✗ | Spring @Scheduled has no run-at-boot trigger. |
✓ works as written · ↻ different syntax · ≠ runs at other times · ? not documented · ✗ can't
Cron runs the line. Nobody tells you how it went.
RunWisp is an open-source cron replacement that ships as a single binary. It reads the same cron line and keeps a record of every run: output, exit code, duration.
# crontab -e (runs on the server's clock: UTC)
@reboot /usr/local/bin/job.sh [tasks.job]
run_on_start = "boot"
timezone = "UTC"
run = '/usr/local/bin/job.sh' | cron | RunWisp | |
|---|---|---|
| The server was off at run time | Skipped. anacron only catches up cron.daily, weekly and monthly. | Runs the most recent missed run at start-up (catch_up = 1) and sends a missed-run alert. |
| The last run is still going | Starts another copy on top. | Queues it. on_overlap = "queue" is the default. |
| A run fails | Output is mailed if MAILTO and a mail server work. No output, no mail, whatever the exit code. | Marked failed and sent to your alert channels. retry_attempts adds retries. |
Keep your crontab. sudo runwisp takeover runs it where it is and retires cron,
crontab -e keeps working, and runwisp service uninstall puts cron
back. It needs Linux with systemd; elsewhere, runwisp import cron converts the
file. RunWisp doesn't do L, W or #, and it runs
on one machine, not a cluster.
Moving from cron →
Questions
What does @reboot mean?
How do I run a job at reboot with a systemd timer?
OnBootSec=0. systemd timer has no @reboot.How do I run a job at reboot in a Kubernetes CronJob?
How do I run a job at reboot in GitHub Actions?
How do I run a job at reboot on AWS EventBridge?
Similar schedules
Start in 30 seconds. Ship on your terms.
A single Go binary. If it doesn't earn the disk space, rm it. No account, no signup, no catch.
curl -fsSL https://get.runwisp.com | sh