2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-03 10:46:53 +00:00

HMCCU: Fixed RPC server start/stop

git-svn-id: https://svn.fhem.de/fhem/trunk@11062 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
fhemzap 2016-03-13 17:40:09 +00:00
parent 2c8f51f907
commit b2711fb9e1

View File

@ -63,17 +63,17 @@ sub CheckProcess ($$)
my ($prcname, $port) = @_;
my $filename = $prcname;
my $pdump = `ps -ef | grep $prcname | grep -v grep`;
my $pdump = `ps ax | grep $prcname | grep -v grep`;
my @plist = split "\n", $pdump;
foreach my $proc (@plist) {
# Remove leading blanks, fix for MacOS. Thanks to mcdeck
$proc =~ s/^\s+//;
my @procattr = split /\s+/, $proc;
if ($procattr[1] != $$ && $procattr[7] =~ /perl$/ &&
($procattr[8] eq $prcname || $procattr[8] =~ /\/ccurpcd\.pl$/) &&
$procattr[10] eq "$port") {
if ($procattr[0] != $$ && $procattr[4] =~ /perl$/ &&
($procattr[5] eq $prcname || $procattr[5] =~ /\/ccurpcd\.pl$/) &&
$procattr[7] eq "$port") {
Log "Process $proc is running connected to CCU port $port";
return $procattr[1];
return $procattr[0];
}
}