# Cron doesn't run



## yhq_34 (Sep 3, 2016)

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.

```
@reboot sleep 60;   root     sh /root/check
```


----------



## getopt (Sep 3, 2016)

```
@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

```
SHELL=/bin/sh
```
So there is no need to specify sh.


----------



## Juha Nurmela (Sep 3, 2016)

Arn't the fields in a funny order? 
	
	



```
@reboot root /bin/sleep 60; /root/check
```

Juha


----------



## kpa (Sep 3, 2016)

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:


```
@reboot sleep 60; /root/check
```


----------



## Juha Nurmela (Sep 3, 2016)

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

```
3g:
   !bg /foo/gps_start
```
 With this everything starts (usually) with no delays at all.


----------



## Murph (Sep 3, 2016)

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.


----------

