I'd like to run a script at 6pm on a remote server but don't want to wait around to trigger it. I don't want to use cron since it's a one time deal.

Can I do something like "nohup myscript &" with a "sleep" or "after" command?

Thanks!

link|improve this question
feedback

2 Answers

up vote 5 down vote accepted

Are you sure you aren't looking for something like at.

link|improve this answer
I think you're right! would you mind posting the right syntax? is it "nohup script.sh | at now +4 hours &" ? (just a guess, clearly! thanks – user41172 Apr 21 '10 at 22:43
at queues and executes whatever you give it on stdin, so syntax is e.g. 'echo script.sh | at now +4 hours'. you don't need nohup with at. see the man page for at for more details. – Craig Sanders Apr 22 '10 at 0:36
feedback

You can use the at (man at) command to do this, and then you don't need the nohup.

If you really wanted to, you could:

nohup bash -c 'sleep 5; command' &

But you might be better off running the command in screen and then use sleep before it so you can easily check the output.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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