entsprechende Abfragen für Pfade ein gebaut
This commit is contained in:
parent
b9708a909d
commit
4df083cbf9
15
74_HOMBOT.pm
15
74_HOMBOT.pm
@ -35,7 +35,7 @@ use Time::HiRes qw(gettimeofday);
|
||||
use HttpUtils;
|
||||
use Blocking;
|
||||
|
||||
my $version = "0.2.3";
|
||||
my $version = "0.2.4";
|
||||
|
||||
|
||||
|
||||
@ -67,17 +67,14 @@ sub HOMBOT_Define($$) {
|
||||
my ( $hash, $def ) = @_;
|
||||
|
||||
my @a = split( "[ \t][ \t]*", $def );
|
||||
|
||||
|
||||
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 /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" );
|
||||
|
||||
|
||||
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 $host = $a[2];
|
||||
@ -90,6 +87,8 @@ sub HOMBOT_Define($$) {
|
||||
$hash->{VERSION} = $version;
|
||||
$hash->{helper}{requestErrorCounter} = 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)";
|
||||
@ -849,9 +848,7 @@ sub HOMBOT_Check_Bot_Alive($) {
|
||||
my $hash = $defs{$name};
|
||||
my $host = $hash->{HOST};
|
||||
my $sshalive;
|
||||
my $sshpass;
|
||||
$sshpass = "/usr/bin/sshpass" unless( -X "/usr/bin/sshpass" );
|
||||
$sshpass = "/usr/local/bin/sshpass" unless( -X "/usr/local/bin/sshpass" );
|
||||
my $sshpass = $hash->{helper}{sshpass};
|
||||
|
||||
Log3 $name, 3, "HOMBOT ($name) - Start SSH Connection for check Hombot alive";
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user