Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

Re: process run in background

by stevieb (Canon)
on Jul 27, 2016 at 11:59 UTC ( #1168637=note: print w/replies, xml ) Need Help??

in reply to process run in background

I like Proc::Background for this task, as it is cross-platform (*nix and Windows).

It's as simple as:

my $bg = Proc::Background->new(@cmd_and_args); my $pid = $bg->pid;

I've used it in a more complex way with start/stop/status functionality with run-in-foreground ability, where the server code is in a module: server module (the bg proc is actually created on line 106), and then a script that starts, stops etc the daemon: server control script.

Essentially how it works is that the script is called from the CLI, which in turn executes the module start code, which re-calls the script with a different argument, which calls the listener/network code in the module which is put into the background.

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (3)
As of 2023-01-29 15:03 GMT
Find Nodes?
    Voting Booth?

    No recent polls found