blob: 275db7eeada2393e0df4882383ad0f1d5ee640de (
plain)
1 #!/bin/sh
2 #
3 # /etc/rc.d/lxc-users: start/stop LXC user containers
4 #
5
6 if test ! -f /etc/lxc/lxc-usernet
7 then
8 echo 'LXC not configured for user containers.'
9 exit 1
10 fi
11
12 [ -f /etc/default/lxc ] && . /etc/default/lxc
13
14 case $1 in
15 start)
16 [ "$LXC_AUTO" = true ] || exit 0
17 [ ! -f /var/lock/lxc-users ] || exit 0
18 [ -n "$BOOTGROUPS" ] && BOOTGROUPS="-g $BOOTGROUPS"
19 touch /var/lock/lxc-users
20 for user in $(awk '!/^#/{if($1!~"@"){print$1}}' /etc/lxc/lxc-usernet)
21 do
22 sudo -u $user -i -- lxc-autostart $OPTIONS $BOOTGROUPS
23 done
24 rm -f /var/lock/lxc-users
25 ;;
26 stop)
27 [ -n "$SHUTDOWNDELAY" ] && SHUTDOWNDELAY="-t SHUTDOWNDELAY"
28 for user in $(awk '!/^#/{if($1!~"@"){print$1}}' /etc/lxc/lxc-usernet)
29 do
30 sudo -u $user -i -- lxc-autostart $STOPOPTS $SHUTDOWNDELAY
31 done
32 ;;
33 restart)
34 $0 stop
35 $0 start
36 ;;
37 *)
38 echo "Usage: $0 [start|stop|restart]"
39 ;;
40 esac
41
42 # End of file
|