Skip to content
This repository has been archived by the owner on Sep 7, 2021. It is now read-only.

Commit

Permalink
Check Net Script in Hotplug.d
Browse files Browse the repository at this point in the history
  • Loading branch information
songchenwen committed Jun 9, 2020
1 parent 1baab3a commit 8affca1
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions scripts/check_net.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/bin/bash

scriptpath=/usr/bin/check_net
hotplugpath=/etc/hotplug.d/iface/10-checknet

realrun="$1"

Expand Down Expand Up @@ -96,9 +97,18 @@ adduci() {
fi
}

addhotplug() {
if ! [ -f "$hotplugpath" ]; then
cat <<< "#!/bin/sh
$(echo $scriptpath)">"$hotplugpath"
chmod +x "$hotplugpath"
fi
}

if [ "$realrun" == "" ]; then
checkrunning 2
adduci
addhotplug
logger 'CheckNet: delay check 30 secs'
(sleep 30 && $scriptpath realrun)&
else
Expand Down

0 comments on commit 8affca1

Please sign in to comment.