Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Need a script executed at each reboot in +1 minute. I placed a record @reboot but it is too early for my script. How to execute it sometime after reboot?

share|improve this question
Why is it too early? Maybe an init script would be more suitable (by regarding dependencies, e.g. this script needs networking to be set up first)? –  sr_ Dec 7 '12 at 10:11
my script need be executed after all others, the last in short words –  Yurij73 Dec 7 '12 at 10:22
since your job needs to be executed after everything and since the concept of everything is quite variable (addition of a new autostart@reboot application is not so uncommon), I think it is up to you to place your job into the rc scripts in a way that servers your purpose. Putting your task at the bottom of tasks specified in /etc/rc.local is usually what you want, but depending on your system's startup configuration, this might not hold true all the time. So, test it and see if it works for you. –  MelBurslan Dec 7 '12 at 15:49
Sounds like a case for Upstart? –  nafg Nov 27 '13 at 10:29

1 Answer 1

up vote 12 down vote accepted

Is the script only ever intended to run one minute after boot up, or can it be used at other times, too? In the former case, you can add sleep 60 to the beginning of your script, or in the latter case, add it to the crontab file:

@reboot sleep 60 && my_script.sh

As has been pointed out by sr_, though, perhaps you are tackling this in the wrong way, and a proper init.d or rc.d script would be a more robust solution.

share|improve this answer
Or use a command line option to tweak the delay (e.g. script -s X which would translate to sleep X inside of the script). –  peterph Dec 7 '12 at 10:24

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.