Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Timing An Execution 1

Status
Not open for further replies.

iaresean

Programmer
Mar 24, 2003
570
ZA
Hello all, I have a problem:

Is it at all possible for me to run a script for example and then from that script tell linux to execute another script in for example 5 minutes?
If this is possible could you possibly give me a short example of how to do this.

Any and all effort put in to solving my problem is greatly appreciated. Thank you.
An inexperienced programmer.
 
It's possible using the at command, eg....
[tt]
echo "/path/to/script" | at now +5 minutes
 
Thanks Ygor,
Could you possibly clear one thing up for me. Will this merely output whatever is inside "/my/script" or will it actually allow "/my/script" to execute the commands it contains.
Please excuse me if this is a stupid question, I am very inexperienced.
Thanks alot.
 
The cron daemon will run the script in the background.
 
Help!
I tested it and it worked. But as soon as I incorporate the command into my cgi script using the following command:

system("echo '/path/to/script' | at now +5 minutes");

It never executes. What is going wrong?
 
Nope, sorry my mistake. It is working. Thanks for the quick response Ygor. You get a star.
 
You could also add a sleep command (sleep 300) to execute the rest of the script after 5 minutes.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top