Skip to content

Instantly share code, notes, and snippets.

@cholin
Last active August 29, 2015 13:57
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cholin/10ea7e55347eca71eae2 to your computer and use it in GitHub Desktop.
Save cholin/10ea7e55347eca71eae2 to your computer and use it in GitHub Desktop.
#!/bin/sh
MSG="No batman nodes in range ..."
batctl o | grep -q "$MSG"
if [ $? -eq 0 ]; then
filename=$(date +'wifi-check_%Y-%m-%d_%H-%M.log')
logread > "/tmp/$filename"
wifi
msg="wifi seems stucked - restarting. Logg saved: $filename".
logger -p "error" -t wifi-check $msg
else
bat_peers=$(($(batctl o | wc -l) - 2))
msg="wifi seems working. We have $bat_peers batman-adv peers"
logger -p "info" -t wifi-check $msg
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment