~kampka/ubuntu/quantal/lxc/upstart-instance

« back to all changes in this revision

Viewing changes to debian/lxc.upstart

  • Committer: Christian Kampka
  • Date: 2012-09-12 14:48:22 UTC
  • Revision ID: chris@emerge-life.de-20120912144822-9toflhiee1683zh2
Have upstart run lxc instances 

Show diffs side-by-side

added added

removed removed

Lines of Context:
5
5
stop on starting rc RUNLEVEL=[016]
6
6
 
7
7
env LXC_AUTO="false"
8
 
env LXC_SHUTDOWN_TIMEOUT="120"
9
8
 
10
9
pre-start script
11
10
        [ -f /etc/default/lxc ] && . /etc/default/lxc
24
23
        ls /etc/lxc/auto/* > /dev/null 2>&1 || exit 0;
25
24
        for f in /etc/lxc/auto/*; do
26
25
                c="$(basename $f .conf)"
27
 
                lxc-info -n $c 2>/dev/null | grep state | grep -q "RUNNING" || lxc-start -n $c -f $f -d
28
 
        done
29
 
end script
30
 
 
31
 
post-stop script
32
 
        [ -f /etc/default/lxc ] && . /etc/default/lxc
33
 
 
34
 
        [ "x$LXC_AUTO" = "xtrue" ] || { exit 0; }
35
 
 
36
 
        ls /etc/lxc/auto/* > /dev/null 2>&1 || exit 0;
37
 
        for f in /etc/lxc/auto/*; do
38
 
                c="$(basename $f .conf)"
39
 
                lxc-shutdown -n $c -w -t $LXC_SHUTDOWN_TIMEOUT &
40
 
        done
41
 
 
42
 
        wait
 
26
                start lxc-instance NAME=$c CONFIG=$f
 
27
        done
43
28
end script