add ping via sudo command

This commit is contained in:
Marko Oldenburg 2022-03-17 06:40:16 +01:00
parent 2565d02a1d
commit 90e5fe0054

View File

@ -1,4 +1,4 @@
# $Id: 73_PRESENCE.pm 20782 2019-12-19 10:51:06Z markusbloch $ # $Id: 73_PRESENCE.pm 20782 2019-12-19 10:51:06Z markusbloch $
############################################################################## ##############################################################################
# #
# 73_PRESENCE.pm # 73_PRESENCE.pm
@ -51,6 +51,7 @@ PRESENCE_Initialize($)
"disabledForIntervals ". "disabledForIntervals ".
"fritzboxCheckSpeed:0,1 ". "fritzboxCheckSpeed:0,1 ".
"pingCount:1,2,3,4,5,6,7,8,9,10 ". "pingCount:1,2,3,4,5,6,7,8,9,10 ".
"pingPerSUDO:0,1 ".
"bluetoothHciDevice ". "bluetoothHciDevice ".
"absenceThreshold ". "absenceThreshold ".
"presenceThreshold ". "presenceThreshold ".
@ -778,6 +779,7 @@ sub PRESENCE_DoLocalPingScan($)
my $retcode; my $retcode;
my $return; my $return;
my $temp; my $temp;
my $pingCmd = (AttrVal($name,'pingPerSUDO',0) == 1 ? 'sudo ping' : 'ping');
$SIG{CHLD} = 'IGNORE'; $SIG{CHLD} = 'IGNORE';
@ -814,7 +816,7 @@ sub PRESENCE_DoLocalPingScan($)
} }
else else
{ {
$temp = qx(ping -c $count $device 2>&1); $temp = qx($pingCmd -c $count $device 2>&1);
if(defined($temp) and $temp ne "") if(defined($temp) and $temp ne "")
{ {
@ -2119,3 +2121,4 @@ Options:
=end html_DE =end html_DE
=cut =cut