Skip to content

Instantly share code, notes, and snippets.

@ety001
Created October 22, 2020 02:09
Show Gist options
  • Save ety001/4546b7846aceb67195fb0a39c38bb6c3 to your computer and use it in GitHub Desktop.
Save ety001/4546b7846aceb67195fb0a39c38bb6c3 to your computer and use it in GitHub Desktop.
openwrt reconnect shell
#!/bin/sh
PING=`ping -c 5 114.114.114.114|grep -v grep|grep '64 bytes' |wc -l`
if [ ${PING} -ne 0 ];then
exit 0
else
/etc/init.d/network restart
fi
sleep 10
PING2=`ping -c 5 114.114.114.114|grep -v grep|grep '64 bytes' |wc -l`
if [ ${PING2} -ne 0 ];then
exit 0
else
reboot
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment