Added kill_all function.
git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@325 e3e1d417-86f3-4887-817a-d78f3d33393f
This commit is contained in:
parent
6bf2f64359
commit
ac217055ef
|
@ -130,6 +130,8 @@ if ( !connect( CLIENT, $saddr ) )
|
|||
|
||||
dprint( "Server starting at ".strftime( '%y/%m/%d %H:%M:%S', localtime() )."\n" );
|
||||
|
||||
kill_all();
|
||||
|
||||
socket( SERVER, PF_UNIX, SOCK_STREAM, 0 ) or die( "Can't open socket: $!" );
|
||||
unlink( DC_SOCK_FILE );
|
||||
bind( SERVER, $saddr ) or die( "Can't bind: $!" );
|
||||
|
@ -330,12 +332,26 @@ if ( !connect( CLIENT, $saddr ) )
|
|||
}
|
||||
}
|
||||
}
|
||||
sub kill_all()
|
||||
{
|
||||
sleep( 1 );
|
||||
foreach my $daemon ( @daemons )
|
||||
{
|
||||
qx( killall --quiet --signal -TERM $daemon );
|
||||
}
|
||||
sleep( 1 );
|
||||
foreach my $daemon ( @daemons )
|
||||
{
|
||||
qx( killall --quiet --signal -KILL $daemon );
|
||||
}
|
||||
}
|
||||
sub shutdown_all()
|
||||
{
|
||||
foreach my $process ( values( %pid_hash ) )
|
||||
{
|
||||
stop( $process->{daemon}, @{$process->{args}} );
|
||||
}
|
||||
kill_all();
|
||||
dprint( "Server shutdown at ".strftime( '%y/%m/%d %H:%M:%S', localtime() )."\n" );
|
||||
unlink( DC_SOCK_FILE );
|
||||
close( CLIENT );
|
||||
|
|
Loading…
Reference in New Issue