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