Advertisement
Guest User

check-ifaces

a guest
Apr 2nd, 2020
34
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.57 KB | None | 0 0
  1. #!/bin/bash
  2. echo $( date )
  3.  
  4. for my_iface in wan lan vpn_turris guest_turris radio0 radio1
  5. do echo -n "Interface: $my_iface "
  6.  
  7. case $my_iface in
  8. radio0) iface_status=$( wifi status | grep -i '"up":' | head -1 | sed  -e 's/^.*: //' -e 's/,$//' )
  9. ;;
  10. radio1) iface_status=$( wifi status | grep -i '"up":' | tail -1 | sed  -e 's/^.*: //' -e 's/,$//' )
  11. ;;
  12. *)      iface_status=$( ifstatus $my_iface | grep -i '"up":' | sed  -e 's/^.*: //' -e 's/,$//' )
  13. ;;
  14. esac
  15.  
  16. if [[ $iface_status == "false" ]] ; then echo " [ DOWN ]" ; else echo " [ UP ]" ; fi
  17.  
  18. done
  19. echo $( date )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement