]> git.proxmox.com Git - mirror_lxc.git/blame - config/init/upstart/lxc.conf.in
spelling: timeout
[mirror_lxc.git] / config / init / upstart / lxc.conf.in
CommitLineData
dc068290
SG
1description "lxc"
2author "Serge Hallyn <serge.hallyn@canonical.com>"
3
4start on runlevel [2345]
5stop on starting rc RUNLEVEL=[016]
6
7env LXC_AUTO="false"
8
015f0dd7
MW
9# These can be overridden in /etc/default/lxc
10
11# BOOTGROUPS - What groups should start on bootup?
12# Comma separated list of groups.
13# Leading comma, trailing comma or embedded double
14# comma indicates when the NULL group should be run.
15# Example (default): boot the onboot group first then the NULL group
16env BOOTGROUPS="onboot,"
17
18# SHUTDOWNDELAY - Wait time for a container to shut down.
19# Container shutdown can result in lengthy system
20# shutdown times. Even 5 seconds per container can be
21# too long.
22env SHUTDOWNDELAY=5
23
24# OPTIONS can be used for anything else.
25# If you want to boot everything then
26# options can be "-a" or "-a -A".
27env OPTIONS=
28
29# STOPOPTS are stop options. The can be used for anything else to stop.
30# If you want to kill containers fast, use -k
31env STOPOPTS="-a -A -s"
32
dc068290
SG
33pre-start script
34 [ -f /etc/default/lxc ] && . /etc/default/lxc
35
36 # don't load profiles if mount mediation is not supported
37 SYSF=/sys/kernel/security/apparmor/features/mount/mask
38 if [ -f $SYSF ]; then
580f58c7
MP
39 if [ -x /lib/apparmor/profile-load ]; then
40 /lib/apparmor/profile-load usr.bin.lxc-start
41 /lib/apparmor/profile-load lxc-containers
d2111444
SG
42 elif [ -x /lib/init/apparmor-profile-load ]; then
43 /lib/init/apparmor-profile-load usr.bin.lxc-start
44 /lib/init/apparmor-profile-load lxc-containers
dc068290
SG
45 fi
46 fi
47
48 [ "x$LXC_AUTO" = "xtrue" ] || exit 0
49
015f0dd7
MW
50 if [ -n "$BOOTGROUPS" ]
51 then
52 BOOTGROUPS="-g $BOOTGROUPS"
53 fi
54
55 # Process the "onboot" group first then the NULL group.
56 lxc-autostart -L $OPTIONS $BOOTGROUPS | while read line; do
dc068290
SG
57 set -- $line
58 (start lxc-instance NAME=$1 && sleep $2) || true
59 done
60end script
e582991f 61
015f0dd7
MW
62# The stop is serialized and can take excessive time. We need to avoid
63# delaying the system shutdown / reboot as much as we can since it's not
da43e9e5 64# parallelized... Even 5 second timeout may be too long.
e582991f 65post-stop script
015f0dd7
MW
66 [ -f /etc/default/lxc ] && . /etc/default/lxc
67
68 if [ -n "$SHUTDOWNDELAY" ]
69 then
70 SHUTDOWNDELAY="-t $SHUTDOWNDELAY"
71 fi
72
73 lxc-autostart $STOPOPTS $SHUTDOWNDELAY || true
e582991f 74end script