Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Backgrounding a Program

by Erik Hensema (Sexton)
on Nov 16, 2001 at 03:01 UTC ( [id://125717]=note: print w/replies, xml ) Need Help??


in reply to Backgrounding a Program

On Unix systems you can use this:

use POSIX; sub daemon { if($pid = fork) { # Parent exit 0; } elsif (defined $pid) { # Child setsid(); # detach session do_stuff(); # do some usefull stuff } else { die "Cannot fork: $!\n"; } }

Replies are listed 'Best First'.
Re: Re: Backgrounding a Program
by rob_au (Abbot) on Nov 16, 2001 at 08:49 UTC
    Just a quick note, the usage of POSIX doesn't necessarily exclude Windows-based systems with Windows NT and 2000 being POSIX-compliant (although I should note, there were a couple of questions on some functions with Windows NT) - The usage of POSIX does however preclude Windows 9x, for which Win32::Process offers a better solution with regard to setting priority classes and process suspension and execution.

     

    Ooohhh, Rob no beer function well without!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://125717]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (4)
As of 2024-04-25 19:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found