Helpful Information
 
 
Category: Perl Programming
Backgrounding processes

Hi All,

I'd like to know how to send an external process to the background, so that I can run multiple instances of the same process at one time. Any tips, links.. etc??

TIA,

Dirk

Well if you're running it from the command prompt you can do it like this:
perl /path/to/file.pl &

the '&' will run it as a background process.

To make the script figure out stuff and run the background take more work.

You may need to check time of day within your code.

#!/usr/bin/perl

while (1)
{
($second,$minute,$hour,$day,$month,$year,$week,$isdst) = localtime(time);

if ($hour eq 9)
{
do something ...
}

sleep(3600);
}

exit(0);

Then of course, run your program like the following:
perl youfile.pl &



[This message has been edited by Helicon (edited October 27, 2000).]

Can I just clarify, does background processing mean I could set a script off via Telnet using the above method and log out with the script continuing to run 24/7?

Also, what does "sleep(3600);" mean?

Sorry for the intrusion into the thread, but I think you just solved a few major headaches for me!

Cheers
Trev










privacy (GDPR)