To have auto-restart of my containers after a host reboot I add a sticky bit to their configuration file (indeed this does my lxc meta-script) and on the host I have the init-script:
root@vms2:/lxc# cat /etc/init.d/lxc #!/bin/sh # ### BEGIN INIT INFO # Provides: lxc # Required-Start: $remote_fs $syslog # Required-Stop: $remote_fs $syslog # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: lxc sysv init script # Description: linux containers auto start/stop ### END INIT INFO # PATH=/root/bin:/opt/lxc-0.7.4.1/bin:$PATH case "$1" in start) for c in /lxc/*.cfg; do test -k $c && lxc -b $c done ;; stop) for c in /lxc/*cfg; do c=$(basename $c .cfg) if [ -d /cgroup/$c ]; then lxc -st $c fi done ;; status) lxc -l ;; *) echo "Usage: /etc/init.d/lxc {start|stop|status}" exit 1 esac This does the trick: root@zoo:/lxc# lxc -l container disk (MB) RAM (MB) start-PID status bunny 517 6 5334 running ubuntu 517 0 0 stopped root@zoo:/lxc# reboot Broadcast message from root@zoo (/dev/pts/0) at 17:58 ... The system is going down for reboot NOW! root@zoo:/lxc# Write failed: Broken pipe root@obertux:~# root@obertux:~# ssh zoo root@zoo:~# lxc -l container disk (MB) RAM (MB) start-PID status bunny 517 6 1229 running ubuntu 517 0 0 stopped -- Ullrich Horlacher Server- und Arbeitsplatzsysteme Rechenzentrum E-Mail: horlac...@rus.uni-stuttgart.de Universitaet Stuttgart Tel: ++49-711-685-65868 Allmandring 30 Fax: ++49-711-682357 70550 Stuttgart (Germany) WWW: http://www.rus.uni-stuttgart.de/ ------------------------------------------------------------------------------ vRanger cuts backup time in half-while increasing security. With the market-leading solution for virtual backup and recovery, you get blazing-fast, flexible, and affordable data protection. Download your free trial now. http://p.sf.net/sfu/quest-d2dcopy1 _______________________________________________ Lxc-users mailing list Lxc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/lxc-users