Daemon-Generic
view release on metacpan or search on metacpan
return (
savestate => 'Tell xyz server to save its state',
reset => 'Tell xyz servr to reset',
);
}
gd_flags_more Like "gd_commands_more()" but defines additional command
line flags. There should also be a "gd_more_opt()" or an
"options" argument to "new()".
gd_positional_more
Like "gd_commands_more()" but defines positional
arguments.
gd_usage() Display a usage message. The return value from
"gd_usage()" is the exit code for the program.
gd_more_opt() () Additional arguments for Getopt::Long::GetOptions
which is used to parse @ARGV. Alternatively: pass
"options" to "new()".
gd_pidfile() Figure out the PID file should be.
gd_error() Print out an error (call die?)
gd_other_cmd() Called $ARGV[0] isn't one of the commands that
Daemon::Generic knows by default. Default behavior: call
"gd_usage()" and exit(1).
gd_daemonize() Normal behavior: "fork()", "fork()", detach from tty.
gd_redirect_output()
This is a mis-named method. Sorry. This directs
"STDOUT"/"STDERR"/"STDIN" to "/dev/null" as part of
daemonizing. Used by "gd_daemonize()".
gd_reopen_output()
After daemonizing, output file descriptors are be
re-established. Normal behavior: redirect "STDOUT" and
"STDERR" to "logger -t $progname[$$]". Used by
"gd_daemonize()".
gd_logname() Normal behavior: $progname[$$]. Used by
"gd_redirect_output()".
gd_reconfig_event()
Normal behavior: call "gd_postconfig(gd_preconfig))".
Only referenced by "gd_setup_signals()".
gd_quit_event()
Normal behavior: exit. Only referenced by
"gd_setup_signals()".
gd_kill_groups()
Return true if gd_kill should kill process groups ($pid)
instead of just the one daemon ($pid). Default is false.
gd_kill($pid) Used by the "stop" and "restart" commands to get rid of
the old daemon. Normal behavior: send a SIGINT. Check to
see if process $pid has died. If it has not, keep
checking and if it's still alive. After
$Daemon::Generic::force_quit_delay seconds, send a
SIGTERM. Keep checking. After another
$Daemon::Generic::force_quit_delay seconds, send a
SIGKILL (-9). Keep checking. After
"$Daemon::Generic::force_quit_delay * 4" seconds or 60
seconds (whichever is smaller), give up and exit(1).
gd_install Installs the daemon so that it runs automatically at next
reboot. Currently done with a symlink to $0 and
"/usr/sbin/update-rc.d". Please send patches for other
methods!
gd_can_install Returns a function to do an "gd_install" if installation
is possible. Returns 0 otherwise.
gd_install_pre($method)
Normal behavior: return. Called just before doing an
installation. The method indicates the installation
method (currently always "update-rc.d".)
gd_install_post($method)
Normal behavior: return. Called just after doing an
installation.
gd_uninstall Will remove the daemon from the automatic startup regime.
gd_can_uninstall
Returns a function to do the work for "gd_uninstall" if
it's possible. 0 otherwise.
gd_uninstall_pre($method)
Normal behavior: return. Called just before doing an
un-installation. The method indicates the installation
method (currently always "update-rc.d".)
gd_install_post($method)
Normal behavior: return. Called just after doing an
un-installation.
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 "gd_".
configfile The location of the configuration file. (Not used by
Daemon::Generic).
debug Display debugging? (Not used by Daemon::Generic)
gd_args The original %args passed to "new".
gd_progname The process name. (defaults to $0)
gd_pidfile The location of the process ID file.
gd_logpriority Used for "logger -p".
gd_foreground Are we running in the foreground?
EXAMPLE PROGRAM
( run in 1.077 second using v1.01-cache-2.11-cpan-39bf76dae61 )