entsprechende Abfragen für Pfade ein gebaut
This commit is contained in:
15
74_HOMBOT.pm
15
74_HOMBOT.pm
@ -35,7 +35,7 @@ use Time::HiRes qw(gettimeofday);
|
|||||||
use HttpUtils;
|
use HttpUtils;
|
||||||
use Blocking;
|
use Blocking;
|
||||||
|
|
||||||
my $version = "0.2.3";
|
my $version = "0.2.4";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -68,16 +68,13 @@ sub HOMBOT_Define($$) {
|
|||||||
|
|
||||||
my @a = split( "[ \t][ \t]*", $def );
|
my @a = split( "[ \t][ \t]*", $def );
|
||||||
|
|
||||||
|
|
||||||
return "too few parameters: define <name> HOMBOT <HOST>" if( @a != 3 );
|
return "too few parameters: define <name> HOMBOT <HOST>" if( @a != 3 );
|
||||||
return "please check if ssh installed" unless( -X "/usr/bin/ssh" );
|
return "please check if ssh installed" unless( -X "/usr/bin/ssh" );
|
||||||
return "please check if /opt/fhem/.ssh/known_hosts exist" unless( -R "/opt/fhem/.ssh/known_hosts" or -R "/root/.ssh/known_hosts" );
|
return "please check if $attr{global}{modpath}/.ssh/known_hosts or /root/.ssh/known_hosts exist" unless( -R "$attr{global}{modpath}/.ssh/known_hosts" or -R "/root/.ssh/known_hosts" );
|
||||||
return "please check if sshpass installed" unless( -X "/usr/bin/sshpass" or -X "/usr/local/bin/sshpass" );
|
return "please check if sshpass installed" unless( -X "/usr/bin/sshpass" or -X "/usr/local/bin/sshpass" );
|
||||||
|
|
||||||
|
|
||||||
my $sshpass;
|
|
||||||
$sshpass = "/usr/bin/sshpass" unless( -X "/usr/bin/sshpass" );
|
|
||||||
$sshpass = "/usr/local/bin/sshpass" unless( -X "/usr/local/bin/sshpass" );
|
|
||||||
|
|
||||||
|
|
||||||
my $name = $a[0];
|
my $name = $a[0];
|
||||||
my $host = $a[2];
|
my $host = $a[2];
|
||||||
@ -90,6 +87,8 @@ sub HOMBOT_Define($$) {
|
|||||||
$hash->{VERSION} = $version;
|
$hash->{VERSION} = $version;
|
||||||
$hash->{helper}{requestErrorCounter} = 0;
|
$hash->{helper}{requestErrorCounter} = 0;
|
||||||
$hash->{helper}{setErrorCounter} = 0;
|
$hash->{helper}{setErrorCounter} = 0;
|
||||||
|
$hash->{helper}{sshpass} = "/usr/bin/sshpass";
|
||||||
|
$hash->{helper}{sshpass} = "/usr/local/bin/sshpass" unless( -X "/usr/bin/sshpass");
|
||||||
|
|
||||||
|
|
||||||
Log3 $name, 3, "HOMBOT ($name) - defined with host $hash->{HOST} on port $hash->{PORT} and interval $hash->{INTERVAL} (sec)";
|
Log3 $name, 3, "HOMBOT ($name) - defined with host $hash->{HOST} on port $hash->{PORT} and interval $hash->{INTERVAL} (sec)";
|
||||||
@ -849,9 +848,7 @@ sub HOMBOT_Check_Bot_Alive($) {
|
|||||||
my $hash = $defs{$name};
|
my $hash = $defs{$name};
|
||||||
my $host = $hash->{HOST};
|
my $host = $hash->{HOST};
|
||||||
my $sshalive;
|
my $sshalive;
|
||||||
my $sshpass;
|
my $sshpass = $hash->{helper}{sshpass};
|
||||||
$sshpass = "/usr/bin/sshpass" unless( -X "/usr/bin/sshpass" );
|
|
||||||
$sshpass = "/usr/local/bin/sshpass" unless( -X "/usr/local/bin/sshpass" );
|
|
||||||
|
|
||||||
Log3 $name, 3, "HOMBOT ($name) - Start SSH Connection for check Hombot alive";
|
Log3 $name, 3, "HOMBOT ($name) - Start SSH Connection for check Hombot alive";
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user