diff options
author | Erich Eckner <git@eckner.net> | 2020-10-10 20:15:01 +0200 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2020-10-10 20:15:01 +0200 |
commit | 1ca52ae8519aadb8ba42f4a7af2b0f13ac6e01ff (patch) | |
tree | 5884f1a16d8a26fd5770aa46c632aa5127412551 /reboot-if-no-net-connection.in | |
parent | fb789e7d52cc67d3f5a3e713a355e121e772ebcb (diff) | |
download | reboot-if-no-net-connection-1ca52ae8519aadb8ba42f4a7af2b0f13ac6e01ff.tar.xz |
Makefile neu
Diffstat (limited to 'reboot-if-no-net-connection.in')
-rwxr-xr-x | reboot-if-no-net-connection.in | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/reboot-if-no-net-connection.in b/reboot-if-no-net-connection.in new file mode 100755 index 0000000..b1d41fb --- /dev/null +++ b/reboot-if-no-net-connection.in @@ -0,0 +1,25 @@ +#!/bin/bash + +# Version #VERSION# + +for i in {1..300}; do + + default_gateway=$( + ip route \ + | sed ' + s/^default\s\+\S\+\s\+\(\S\+\)\s.*$/\1/ + t + d + ' + ) + + if [ -n "${default_gateway}" ] \ + && ping -c1 "${default_gateway}" >/dev/null 2>&1; then + exit + fi + + sleep 1 + +done + +reboot |