emit net-device-down signal when network-manager deconfigures interface
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
network-manager (Ubuntu) |
Confirmed
|
Undecided
|
Unassigned |
Bug Description
I want to execute a script when network (any interface) goes up and when goes down (with parameters).
I've found easy to trigger first part with
start on (net-device-up IFACE!=lo)
but didn't manage to found an easy way to trigger either net-device-down, net-device-
my job loks like this:
#######
description "network test"
start on (net-device-up IFACE!=lo)
# stop on ((net-device-down IFACE!=lo) or deconfiguring-
stop on net-device-removed IFACE!=lo
pre-start exec /opt/test.sh start "$UPSTART_JOB - EVENT: $UPSTART_EVENTS"
post-stop exec /opt/test.sh stop "$UPSTART_JOB - EVENT: $UPSTART_
#######
to test it I just go to nm-applet and deactivate one interface.
I've finally managed to make it work creating a simple script in '/etc/network/
#######
#!/bin/sh
[ "$IFACE" != "lo" ] || exit 0
initctl emit -n net-device-removed IFACE=$IFACE
#######
I'm not sure if this is expecte behaviour, if this is a feature request or if it's a real bug, but for company pourposes I really need to emit a signal when any interface (not lo) goes down.
please, ask for further info
EDITED: I can see here
https:/
that '/etc/network/
event not emited by '/etc/network/
description: | updated |
summary: |
- emmit signal when network-manager deconfigures interface + emit signal when network-manager deconfigures interface |
summary: |
- emit signal when network-manager deconfigures interface + emit net-device-down signal when network-manager deconfigures interface |
Excerpts from muzzol's message of Sat May 12 14:38:54 UTC 2012: remove( d) , deconfiguring- networking ####### ####### ####### ####### ####### ####### ####### ####### ### networking) STOP_EVENTS"
> ** Description changed:
>
> I want to execute a script when network (any interface) goes up and when
> goes down (with parameters).
>
> I've found easy to trigger first part with
>
> - start on (net-device-up IFACE!=lo)
> + start on (net-device-up IFACE!=lo)
>
> but didn't manage to found an easy way to trigger either net-device-
> down, net-device-
> -
>
> my job loks like this:
>
> #######
> description "network test"
>
> start on (net-device-up IFACE!=lo)
> # stop on ((net-device-down IFACE!=lo) or deconfiguring-
> stop on net-device-removed IFACE!=lo
>
> pre-start exec /opt/test.sh start "$UPSTART_JOB - EVENT:
> $UPSTART_EVENTS"
>
> post-stop exec /opt/test.sh stop "$UPSTART_JOB - EVENT:
> $UPSTART_
>
net-device-down should be emitted whenever an interface goes down:
$ cat !$ if-down. d/upstart
cat /etc/network/
#!/bin/sh
set -e
initctl emit -n net-device-down \ $LOGICAL" \ $ADDRFAM" \ $METHOD"
"IFACE=$IFACE" \
"LOGICAL=
"ADDRFAM=
"METHOD=