network -> lo.iface
This commit is contained in:
parent
e61bb3c1b2
commit
91965639f3
37
init.d/lo.iface
Executable file
37
init.d/lo.iface
Executable file
|
@ -0,0 +1,37 @@
|
|||
#!/usr/bin/env watchman
|
||||
|
||||
cfg_iface="${service_name%%.*}"
|
||||
|
||||
service_type='oneshot'
|
||||
service_command="ip link set $cfg_iface up"
|
||||
|
||||
wait_for_iface() {
|
||||
local iface="$1" timer='0' timeout='6'
|
||||
|
||||
until [[ "ip link show $iface up" ]]; do
|
||||
[[ "$timer" -ge "$timeout" ]] && { return 1; }
|
||||
timer=$[timer+1]
|
||||
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.status || {
|
||||
watchman.err "$service_name is already disabled"
|
||||
return 1
|
||||
}
|
||||
|
||||
watchman.msg "Deactivating the $cfg_iface interface..."
|
||||
|
||||
ip link set "${cfg_iface}" down
|
||||
watchman.stop
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
#!/usr/bin/env watchman
|
||||
|
||||
service_type='oneshot'
|
||||
service_command='ip'
|
||||
service_args='link set lo up'
|
||||
|
||||
start() {
|
||||
watchman.msg "Activating the loopback interface (lo)..."
|
||||
watchman.start
|
||||
}
|
||||
|
||||
stop() {
|
||||
watchman.status || {
|
||||
watchman.err "$service_name is already disabled"
|
||||
return 1
|
||||
}
|
||||
watchman.msg "Deactivating the loopback interface (lo)..."
|
||||
ip link set lo down
|
||||
watchman.stop
|
||||
}
|
Loading…
Reference in New Issue
Block a user