From 49e76c666bb13ed2f3addb4e871a79b1316a8f0a Mon Sep 17 00:00:00 2001 From: SymKat Date: Mon, 3 Sep 2012 13:50:09 -0700 Subject: [PATCH] HUP -> Reload. --- lib/Daemon/Control.pm | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/lib/Daemon/Control.pm b/lib/Daemon/Control.pm index 1fb8004..46411ce 100644 --- a/lib/Daemon/Control.pm +++ b/lib/Daemon/Control.pm @@ -352,6 +352,18 @@ sub do_status { } } +sub do_reload { + my ( $self ) = @_; + $self->read_pid; + + if ( $self->pid && $self->pid_running ) { + kill "SIGHUP", $self->pid; + $self->pretty_print( "Reloaded" ); + } else { + $self->pretty_print( "Not Running", "red" ); + } +} + sub do_get_init_file { shift->dump_init_script; } @@ -422,7 +434,7 @@ sub run { if ( $self->can($action) ) { $self->$action; } elsif ( ! $called_with ) { - die "Must be called with an action [start|stop|restart|status|show_warnings]"; + die "Must be called with an action [start|stop|restart|reload|status|show_warnings]"; } else { die "Error: undefined action $called_with"; } @@ -738,6 +750,13 @@ Called by: /usr/bin/my_program_launcher.pl restart +=head2 do_reload + +Is called when reload is given as an argument. Sends a HUP signal to the +daemon. + + /usr/bin/my_program_launcher.pl reload + =head2 do_status Is called when status is given as an argument. Displays the status of the