Daemon-Generic

 view release on metacpan or  search on metacpan

lib/Daemon/Generic.pod  view on Meta::CPAN

The return value from C<gd_usage()> is the exit code for the program.

=item gd_more_opt()

() Additional arguments for L<Getopt::Long::GetOptions> which
is used to parse C<@ARGV>.  Alternatively: pass C<options> to C<new()>.

=item gd_pidfile()

Figure out the PID file should be. 

=item gd_error()

Print out an error (call die?)

=item gd_other_cmd()

Called C<$ARGV[0]> isn't one of the commands that Daemon::Generic knows
by default.  Default behavior: call C<gd_usage()> and C<exit(1)>. 

=item gd_daemonize()

Normal behavior: C<fork()>, C<fork()>, detach from tty.

=item gd_redirect_output()

This is a mis-named method.  Sorry.  This directs C<STDOUT>/C<STDERR>/C<STDIN>
to C</dev/null> as part of daemonizing.  Used by C<gd_daemonize()>.

=item gd_reopen_output()

After daemonizing, output file descriptors are be re-established.
Normal behavior: redirect C<STDOUT> and C<STDERR> to 
C<logger -t $progname[$$]>.  Used by C<gd_daemonize()>.

=item gd_logname()

Normal behavior: C<$progname[$$]>.  Used by C<gd_redirect_output()>.

=item gd_reconfig_event()

Normal behavior: call C<gd_postconfig(gd_preconfig))>.  
Only referenced by C<gd_setup_signals()>.

=item gd_quit_event()

Normal behavior: exit. 
Only referenced by C<gd_setup_signals()>.

=item gd_kill_groups()

Return true if gd_kill should kill process groups ($pid) instead of just
the one daemon ($pid).  Default is false.

=item gd_kill($pid)

Used by the C<stop> and C<restart> commands to get rid of
the old daemon.
Normal behavior: send a SIGINT.  
Check to see if process C<$pid> has died.  If it has not, keep checking
and if it's still alive.  After 
C<$Daemon::Generic::force_quit_delay> seconds,
send a SIGTERM.  Keep checking.  After another
C<$Daemon::Generic::force_quit_delay> seconds,
send a SIGKILL (-9).  Keep checking.  After 
C<$Daemon::Generic::force_quit_delay * 4> seconds or 60 seconds
(whichever is smaller), give up and exit(1).

=item gd_install

Installs the daemon so that it runs automatically at next
reboot.  Currently done with a symlink to C<$0> and 
C</usr/sbin/update-rc.d>.  Please send patches for other 
methods!

=item gd_can_install

Returns a function to do an C<gd_install> if installation
is possible.  Returns C<0> otherwise.

=item gd_install_pre($method)

Normal behavior: return.  Called just before doing an installation.
The method indicates the installation method (currently always
C<update-rc.d>.)

=item gd_install_post($method)

Normal behavior: return.  Called just after doing an installation.

=item gd_uninstall

Will remove the daemon from the automatic startup regime.

=item gd_can_uninstall

Returns a function to do the work for C<gd_uninstall> if it's
possible.  C<0> otherwise.

=item gd_uninstall_pre($method)

Normal behavior: return.  Called just before doing an un-installation.
The method indicates the installation method (currently always
C<update-rc.d>.)

=item gd_install_post($method)

Normal behavior: return.  Called just after doing an un-installation.

=back

=head1 MEMBER DATA

Since you need to subclass Daemon::Generic, you need to know
what the internal data structures for Daemon::Generic are.  
With two exceptions, all of the member data items begin with 
the prefix C<gd_>.

=over 15

=item configfile



( run in 1.583 second using v1.01-cache-2.11-cpan-39bf76dae61 )