Bug 207 - Fixed (hopefully) undefed pid issue for restarting crashed processes.
git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@1615 e3e1d417-86f3-4887-817a-d78f3d33393f
This commit is contained in:
parent
90360aa18c
commit
02f3ea1ac5
|
@ -217,11 +217,6 @@ if ( !connect( CLIENT, $saddr ) )
|
|||
{
|
||||
# It's not running, or at least it's not been started by us
|
||||
$process = { daemon=>$daemon, args=>\@args, command=>$command, keepalive=>!undef };
|
||||
# So check whether someone else has started it
|
||||
#$ps_command = "ps -wh --user $> | grep '$command' | grep -v grep";
|
||||
#$ps_array = preg_split( "/\s+/", exec( $ps_command ) );
|
||||
#$pid = $ps_array[3];
|
||||
#if ( $pid )
|
||||
}
|
||||
elsif ( $process->{pid} && $pid_hash{$process->{pid}} )
|
||||
{
|
||||
|
@ -266,7 +261,6 @@ if ( !connect( CLIENT, $saddr ) )
|
|||
foreach my $arg ( @args )
|
||||
{
|
||||
# Detaint arguments, if they look ok
|
||||
#if ( $arg =~ /^(-{0,2}[\w]+)/ )
|
||||
if ( $arg =~ /^(-{0,2}[\w\/?&=.-]+)$/ )
|
||||
{
|
||||
push( @good_args, $1 );
|
||||
|
@ -341,14 +335,17 @@ if ( !connect( CLIENT, $saddr ) )
|
|||
$command .= ' '.join( ' ', ( @args ) ) if ( @args );
|
||||
my $process = $cmd_hash{$command};
|
||||
if ( $process )
|
||||
{
|
||||
if ( $process->{pid} )
|
||||
{
|
||||
my $cpid = $process->{pid};
|
||||
if ( $pid_hash{$cpid} )
|
||||
if ( defined($pid_hash{$cpid}) )
|
||||
{
|
||||
_stop( 0, $daemon, @args );
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
start( $daemon, @args );
|
||||
}
|
||||
sub reaper
|
||||
|
|
Loading…
Reference in New Issue