Proc::Launcher

Yet another forking process controller
Download

Proc::Launcher Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Publisher Name:
  • Alex White
  • Publisher web site:
  • http://search.cpan.org/~vvu/

Proc::Launcher Tags


Proc::Launcher Description

Yet another forking process controller Proc::Launcher is a Perl module designed to fork one or more long-running background processes and to manage them. This includes starting, stopping, and automatically restarting processes--even those that don't behave well.The pid of the forked child processes are written to pid files and persist across multiple restarts of the launcher. This means that stdout/stderr/stdin of the children are not directly connected to the launching process. All stdout and stderr from the child processes is written to a log file.For more useful functions (e.g. a supervisor to restart processes that die), see Proc::Launcher::Manager.SYNOPSIS use Proc::Launcher; # define a method to start your application if it isn't already running use MyApp; my $start_myapp = sub { MyApp->new( context => $some_shared_data )->run() }; # create a new launcher object my $launcher = Proc::Launcher->new( start_method => $start_myapp, daemon_name => 'myapp', ); # an alternate version of the same thing without the subroutine reference my $launcher = Proc::Launcher->new( class => 'MyApp', start_method => 'run' context => $some_shared_data, daemon_name => 'myapp', ); # check if the process was already running if ( $launcher->is_running() ) { warn "Already running!\n" } # start the process if there isn't already one running $launcher->start(); # shut down the process if it is already running. start a new process. $launcher->restart(); # get the process pid my $pid = $launcher->pid(); # kill -HUP $launcher->stop(); # kill -9 $launcher->force_stop(); # get the process log file path my $log = $launcher->log_file; Requirements: · Perl


Proc::Launcher Related Software