mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-02-01 01:09:47 +00:00
98_Hyperion: fix binary restart not working after stop, more error messages
git-svn-id: https://svn.fhem.de/fhem/trunk@15495 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
8b068f59cc
commit
7523029577
@ -421,7 +421,7 @@ sub Hyperion_GetConfigs_finished($)
|
|||||||
foreach (@files)
|
foreach (@files)
|
||||||
{
|
{
|
||||||
my $file = $_;
|
my $file = $_;
|
||||||
next if ($file !~ /^([-\.\w]+)\.config\.json$/);
|
next if ($file !~ /^([\-\.\w]+)\.config\.json$/);
|
||||||
$file = $1;
|
$file = $1;
|
||||||
push @filelist,$file;
|
push @filelist,$file;
|
||||||
Log3 $name,4,"$name: matching config file: \"$_\"";
|
Log3 $name,4,"$name: matching config file: \"$_\"";
|
||||||
@ -472,8 +472,9 @@ sub Hyperion_ExecCmd($)
|
|||||||
foreach (@qx)
|
foreach (@qx)
|
||||||
{
|
{
|
||||||
chomp $_;
|
chomp $_;
|
||||||
$_ =~ s/^[\s\t]{1,}/ /;
|
$_ =~ s/[\s\t\| ;]{1,}/ /g;
|
||||||
push @ret,$_;
|
$_ =~ s/(^ {1,}| {1,}$)//g;
|
||||||
|
push @ret,$_ if ($_);
|
||||||
}
|
}
|
||||||
$re .= join " ",@ret if (@ret);
|
$re .= join " ",@ret if (@ret);
|
||||||
return "$name|$re";
|
return "$name|$re";
|
||||||
@ -489,8 +490,15 @@ sub Hyperion_Kill_finished($)
|
|||||||
delete $hash->{helper}{RUNNING_PID};
|
delete $hash->{helper}{RUNNING_PID};
|
||||||
if ($error)
|
if ($error)
|
||||||
{
|
{
|
||||||
Log3 $name,3,"$name: Not able to stop Hyperion! Error: $error";
|
if ($error =~ /^Usage:/)
|
||||||
readingsSingleUpdate($hash,"lastError",$error,1);
|
{
|
||||||
|
Log3 $name,3,"$name: Hyperion couldn't be stopped because no running pid was found!";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Log3 $name,3,"$name: Not able to stop Hyperion! Error: $error";
|
||||||
|
readingsSingleUpdate($hash,"lastError",$error,1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -509,7 +517,7 @@ sub Hyperion_Restart($)
|
|||||||
my $error = $a[1];
|
my $error = $a[1];
|
||||||
my $hash = $defs{$name};
|
my $hash = $defs{$name};
|
||||||
delete $hash->{helper}{RUNNING_PID};
|
delete $hash->{helper}{RUNNING_PID};
|
||||||
if ($error)
|
if ($error && $error !~ /^Usage:/)
|
||||||
{
|
{
|
||||||
Log3 $name,3,"$name: Not able to stop Hyperion! Error: $error";
|
Log3 $name,3,"$name: Not able to stop Hyperion! Error: $error";
|
||||||
readingsSingleUpdate($hash,"lastError",$error,1);
|
readingsSingleUpdate($hash,"lastError",$error,1);
|
||||||
@ -595,7 +603,7 @@ sub Hyperion_Set($@)
|
|||||||
my $user = AttrVal($name,"hyperionSshUser","pi");
|
my $user = AttrVal($name,"hyperionSshUser","pi");
|
||||||
my $ip = $hash->{IP};
|
my $ip = $hash->{IP};
|
||||||
my $sudo = ($user eq "root" || int AttrVal($name,"hyperionNoSudo",0) == 1) ? "" : "sudo ";
|
my $sudo = ($user eq "root" || int AttrVal($name,"hyperionNoSudo",0) == 1) ? "" : "sudo ";
|
||||||
my $kill = $sudo."kill `pidof $bin`";
|
my $kill = $sudo."kill `pidof $bin` 2>&1 1>/dev/null";
|
||||||
my $ssh;
|
my $ssh;
|
||||||
if (!Hyperion_isLocal($ip))
|
if (!Hyperion_isLocal($ip))
|
||||||
{
|
{
|
||||||
@ -606,7 +614,7 @@ sub Hyperion_Set($@)
|
|||||||
my $com = Hyperion_isLocal($ip)?"":"$ssh $user\@$ip '";
|
my $com = Hyperion_isLocal($ip)?"":"$ssh $user\@$ip '";
|
||||||
if ($cmd eq "binary")
|
if ($cmd eq "binary")
|
||||||
{
|
{
|
||||||
return "Value of $cmd has to be 'stop' or 'restart'" if ($value !~ /^(stop|restart)$/);
|
return "Value of $cmd has to be 'restart' or 'stop'" if ($value !~ /^(stop|restart)$/);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user