| Proc-Daemontools-Service documentation | view source | Contained in the Proc-Daemontools-Service distribution. |
Proc::Daemontools::Service - services that play nicely with daemontools
0.02
package Foo::Service;
use base qw(Proc::Daemontools::Service);
sub svc_up { ... }
# In other code...
my $serv = Foo::Service->new;
$serv->run;
See the daemontools page, at http://cr.yp.to/daemontools.html, and particularly the svc page, at http://cr.yp.to/daemontools/svc.html.
newTakes no arguments (yet).
runInstall signal handlers and call svc_run, which
may continue indefinitely.
If svc_run ever finishes, calls exit.
exit$serv->exit($exit_status);
Exit, calling svc_exit first if it exists. Default
signal handlers call this.
install_handlersInstall signal handlers to queue signals for processing by
svc_* methods, below.
NOTE: signal handlers are global. This means that two instances of Proc::Daemontools::Service will fight with each other. Don't do that.
svc_runCalled by run. Your main program body should be here.
svc_exitCalled by exit. Any cleanup should be here. (optional)
Subclasses should define their own copy of each of these methods. They will be called by Proc::Daemontools::Service as signals are caught.
Names are taken from the full names of svc options.
When called, these methods will be passed a hashref indicating state.
the name of the signal (e.g. TERM)
the number of the signal (e.g. 15)
svc_hangupsvc_alarmsvc_interruptsvc_terminateUncaught signals will cause your program to exit. If your
package defines a svc_exit method, it will be called
before exiting (see exit).
The exit value will be the number of the signal that caused program exit.
svc_defaultOverride this method to provide your own default for the signals listed above.
KILLSTOPCONTTechnically CONT isn't uncatchable; however, given that you can't catch STOP, you probably don't want to catch CONT either.
Hans Dieter Pearcey, <hdp@cpan.org>
Please report any bugs or feature requests to
bug-proc-daemontools-service@rt.cpan.org, or through the web interface at
http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Proc-Daemontools-Service.
I will be notified, and then you'll automatically be notified of progress on
your bug as I make changes.
Copyright 2006 Hans Dieter Pearcey, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
| Proc-Daemontools-Service documentation | view source | Contained in the Proc-Daemontools-Service distribution. |