bash script to run in 5 minutes

James Nine picture James Nine · Oct 19, 2010 · Viewed 24k times · Source

I just want a bash script to run 5 minutes after it's called. What am I doing wrong?

I have the command:

/path/to/my/script | at now + 5 min

And yet the script runs right away every time.

Answer

Jack Kelly picture Jack Kelly · Oct 19, 2010

You are executing the script immediately and sending its output into at. You need to send the name of the script itself into at:

echo /path/to/my/script | at now + 5 min