Added configurable delay to kill_all and fixed signal names.

git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@344 e3e1d417-86f3-4887-817a-d78f3d33393f
This commit is contained in:
stan 2003-01-15 17:31:20 +00:00
parent a3b0eaff26
commit fc015bbc45
1 changed files with 7 additions and 6 deletions

View File

@ -130,7 +130,7 @@ if ( !connect( CLIENT, $saddr ) )
dprint( "Server starting at ".strftime( '%y/%m/%d %H:%M:%S', localtime() )."\n" );
kill_all();
kill_all( 1 );
socket( SERVER, PF_UNIX, SOCK_STREAM, 0 ) or die( "Can't open socket: $!" );
unlink( DC_SOCK_FILE );
@ -334,15 +334,16 @@ if ( !connect( CLIENT, $saddr ) )
}
sub kill_all
{
sleep( 1 );
my $delay = shift;
sleep( $delay );
foreach my $daemon ( @daemons )
{
qx( killall --quiet --signal -TERM $daemon );
qx( killall --quiet --signal TERM $daemon );
}
sleep( 1 );
sleep( $delay );
foreach my $daemon ( @daemons )
{
qx( killall --quiet --signal -KILL $daemon );
qx( killall --quiet --signal KILL $daemon );
}
}
sub shutdown_all()
@ -351,7 +352,7 @@ if ( !connect( CLIENT, $saddr ) )
{
stop( $process->{daemon}, @{$process->{args}} );
}
kill_all();
kill_all( 5 );
dprint( "Server shutdown at ".strftime( '%y/%m/%d %H:%M:%S', localtime() )."\n" );
unlink( DC_SOCK_FILE );
close( CLIENT );