@@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env watchman
|
||||
#!/usr/bin/env ssm
|
||||
|
||||
cfg_iface="${service_name%%.*}"
|
||||
|
||||
@@ -6,7 +6,7 @@ service_type='oneshot'
|
||||
service_command='/usr/bin/ip'
|
||||
service_args=( link set "$cfg_iface" up)
|
||||
|
||||
wait_for_iface() {
|
||||
ready() {
|
||||
local iface="$1" timer='0' timeout='6'
|
||||
|
||||
until [[ "$(ip link show $iface up)" ]]; do
|
||||
@@ -15,18 +15,7 @@ wait_for_iface() {
|
||||
done
|
||||
}
|
||||
|
||||
start() {
|
||||
watchman.msg "Activating the $cfg_iface interface..."
|
||||
watchman.start
|
||||
|
||||
wait_for_iface || {
|
||||
echo "Interface $cfg_iface failed to come up!"
|
||||
return 1
|
||||
}
|
||||
}
|
||||
|
||||
stop() {
|
||||
watchman.msg "Deactivating the $cfg_iface interface..."
|
||||
pre_stop() {
|
||||
ip link set "${cfg_iface}" down
|
||||
watchman.stop
|
||||
super_stop
|
||||
}
|
||||
|
Reference in New Issue
Block a user