caner 2 years ago
parent
commit
59c79e6046
2 changed files with 14 additions and 3 deletions
  1. 1 3
      README.md
  2. 13 0
      check.sh

+ 1 - 3
README.md

@@ -1,3 +1 @@
-# checkNetwork
-
-检查是否联网脚本
+### sh 检测是否联网

+ 13 - 0
check.sh

@@ -0,0 +1,13 @@
+#!/bin/bash
+echo "netWorkTelnet:" $(date +"%Y-%m-%d") >> test.log
+while true
+do
+ping -c 5 -W 100 114.114.114.114
+if [ $? -eq 0 ];then
+echo $(date +"%Y-%m-%d %H:%M:%S") ": ping ok" >> test.log
+sleep 60
+else
+echo $(date +"%Y-%m-%d %H:%M:%S") ": ping fail" >> test.log
+break
+fi
+done