Last active
January 12, 2018 15:38
-
-
Save bduisenov/06b4f3ec58c4a1fac4514cd60b3fa3cd to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#!/bin/bash | |
anybarNotify () { | |
(echo -n "$1" | nc -u -c -w 1 localhost 1738) & | |
} | |
if pgrep AnyBar > /dev/null; then | |
echo "skip starting anybar" | |
else | |
echo "starting anybar" | |
open -a AnyBar | |
fi | |
while ! nc -zu localhost 1738; do sleep 1 && echo -n .; done; | |
echo "anybar is listening" | |
while true; do | |
fping -c1 -t500 -q -a $1 >& /dev/null | |
if [[ $? -eq 0 ]]; then | |
echo "success" | |
anybarNotify "purple" | |
else | |
echo "failed" | |
anybarNotify "red" | |
fi | |
sleep 1 | |
done; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment