fallback for lxc-info 0.7.2
authorDobrica Pavlinusic <dpavlin@rot13.org>
Fri, 9 Sep 2011 18:27:11 +0000 (18:27 +0000)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Fri, 9 Sep 2011 18:27:11 +0000 (18:27 +0000)
git-svn-id: svn://svn.rot13.org/sysadmin-cookbook@272 191e9f34-6774-4a6d-acfc-7664dacd4a2a

recepies/lxc/lxc-watchdog.sh

index ed70fa4..59c8ac9 100755 (executable)
@@ -55,7 +55,8 @@ lxc_ip() {
 
 lxc_status() {
        ( find /var/lib/lxc/ -name "config" | cut -d/ -f5 | sort -u | while read name ; do
-               status=`lxc-info -n $name 2>/dev/null | grep state: | cut -d: -f2`
+               status=`lxc-info -n $name 2>/dev/null | grep state: | cut -d: -f2`     # 0.7.5
+               test -z "$status" && status=`lxc-info -n $name | sed -e 's/^.* is //'` # 0.7.2
                boot="-"
                test -s /var/lib/lxc/$name/on_boot && boot="boot"
                echo "$name $status $boot $(lxc_rootfs $name) $(lxc_ip $name) $(lxc_hostname $name)"