Created
April 28, 2016 06:25
-
-
Save Sitebase/d95e44549669cb7bb40cf377a9f61469 to your computer and use it in GitHub Desktop.
Detect if a certain device is on the network or not. This should work better then a regular ping when you want to check for example phones that go into deep sleep mode.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# usage ./device-detect.sh 192.168.1.5 | |
nmap -sn $1 | grep -q latency | |
result=$? | |
if [ "$result" -eq "1" ]; | |
then | |
echo "Device is offline" | |
else | |
echo "Device is online" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment