~upstart-devel/upstart/upstart-jobs

« back to all changes in this revision

Viewing changes to utopic/etc/init/network-interface.conf

  • Committer: Dimitri John Ledkov
  • Date: 2014-11-19 12:58:41 UTC
  • Revision ID: dimitri.j.ledkov@intel.com-20141119125841-98dr37roy8dvcv3b
auto update

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# network-interface - configure network device
2
 
#
3
 
# This service causes network devices to be brought up or down as a result
4
 
# of hardware being added or removed, including that which isn't ordinarily
5
 
# removable.
6
 
 
7
 
description     "configure network device"
8
 
 
9
 
emits net-device-up
10
 
emits net-device-down
11
 
emits static-network-up
12
 
 
13
 
start on net-device-added
14
 
stop on net-device-removed INTERFACE=$INTERFACE
15
 
 
16
 
instance $INTERFACE
17
 
export INTERFACE
18
 
 
19
 
pre-start script
20
 
    if [ "$INTERFACE" = lo ]; then
21
 
        # bring this up even if /etc/network/interfaces is broken
22
 
        ifconfig lo 127.0.0.1 up || true
23
 
        initctl emit -n net-device-up \
24
 
            IFACE=lo LOGICAL=lo ADDRFAM=inet METHOD=loopback || true
25
 
    fi
26
 
    mkdir -p /run/network
27
 
    if ifquery --allow hotplug -l | grep -q "^${INTERFACE}\$"; then
28
 
        exec ifup --allow hotplug $INTERFACE
29
 
    else
30
 
        exec ifup --allow auto $INTERFACE
31
 
    fi
32
 
end script
33
 
 
34
 
post-stop script
35
 
    if ifquery --allow hotplug -l | grep -q "^${INTERFACE}\$"; then
36
 
        exec ifdown --force --allow hotplug $INTERFACE
37
 
    else
38
 
        exec ifdown --force --allow auto $INTERFACE
39
 
    fi
40
 
end script