2017-07-13 13:09:42 +00:00
|
|
|
#!/usr/bin/env ssm
|
2014-10-04 15:47:02 +00:00
|
|
|
|
|
|
|
cfg_iface="${service_name%%.*}"
|
|
|
|
|
|
|
|
service_type='oneshot'
|
2017-12-10 17:44:17 +00:00
|
|
|
service_command=( /usr/bin/ip link set "$cfg_iface" up )
|
2014-10-04 15:47:02 +00:00
|
|
|
|
2017-07-13 13:09:42 +00:00
|
|
|
ready() {
|
2014-10-04 15:47:02 +00:00
|
|
|
local iface="$1" timer='0' timeout='6'
|
|
|
|
|
2015-05-25 09:26:03 +00:00
|
|
|
until [[ "$(ip link show $iface up)" ]]; do
|
2015-01-19 13:59:09 +00:00
|
|
|
(( timer >= timeout )) && { return 1; }
|
|
|
|
(( timer++ ))
|
2014-10-04 15:47:02 +00:00
|
|
|
done
|
|
|
|
}
|
|
|
|
|
2017-07-13 13:09:42 +00:00
|
|
|
pre_stop() {
|
2014-10-04 15:47:02 +00:00
|
|
|
ip link set "${cfg_iface}" down
|
2017-07-13 13:09:42 +00:00
|
|
|
super_stop
|
2014-10-04 15:47:02 +00:00
|
|
|
}
|