UNPKG
homebridge-netgear-readynas
Version:
latest (1.0.1)
1.0.1
1.0.0
Remote control of ReadyNAS with Homebridge
homebridge-netgear-readynas
/
commands
/
status.js
10 lines
(7 loc)
•
301 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
10
const
{ execSync } =
require
(
'child_process'
);
function
status
(
host
)
{
const
output
=
execSync
(`ping -W
1
-c
1
${host} > /dev/
null
&&
echo
"on"
||
echo
"off"
`);
const
statusBoolean
= output.
toString
().
indexOf
(
'on'
) !== -
1
?
true
:
false
;
return
statusBoolean; } module.exports = status;