Cron doesn't run

How can I run a cron job after 1 minutes when every-time I startup, I setup crontab file in etc like below, but it doesn't work.
Code:
@reboot sleep 60;   root     sh /root/check
 
Code:
@reboot /bin/sleep 60 ; root /root/check
Should do it. Cron has it's own environment, so always use full/path/to/your/file.

See crontab(5). There EXAMPLE CRON FILE
Code:
SHELL=/bin/sh
So there is no need to specify sh.
 
Don't modify /etc/crontab if you can avoid it, use the root's crontab(5) instead. In a user crontab you omit the who field so this one would become:

Code:
@reboot sleep 60; /root/check
 
Or, periodic bootly aka rc.local :)

(sleep 60 && command) & to not suspend booting up

There might be a better way than a blind sleep of 60 seconds? Are you waiting for the network connection perhaps? I have to dance with a brittle 3G/GPS gizmo, which does not like parallel access at all. In /etc/ppp/ppp.linkup
Code:
3g:
   !bg /foo/gps_start
With this everything starts (usually) with no delays at all.
 
You've not said exactly why you want to do this, so this is just a guess at something which might be useful to you. If the real issue is to run something after a particular service has started, that is better achieved by using the REQUIRE: functionality in rcorder(8) / rc(8). Even if 60s would normally be quite safe, it's not unusual for something to stall the boot sequence, which could cause that method to fail; but if you arrange for a new script to fire after the appropriate service, it will always work even after a long stall.
 
Back
Top