--- recepies/lxc/lxc-watchdog.sh 2010/09/11 12:19:12 229 +++ recepies/lxc/lxc-watchdog.sh 2010/10/24 11:55:02 232 @@ -40,15 +40,22 @@ grep '^ *lxc\.rootfs *=' "/var/lib/lxc/$1/config" | cut -d= -f2 | sed 's/^ *//' } +lxc_hostname() { + inside=`cat $(lxc_rootfs $1)/etc/hostname` + config=`grep lxc.utsname /var/lib/lxc/$name/config | cut -d= -f2` + echo "$config [$inside]"; +} + +lxc_ip() { + grep lxc.network.ipv4 /var/lib/lxc/$name/config | cut -d= -f2 || + grep address $(lxc_rootfs $name)/etc/network/interfaces | sed 's/.*address //' +} lxc_status() { ( find /var/lib/lxc/ -name "config" | cut -d/ -f5 | sort -u | xargs -i lxc-info -n {} | sed "s/'//g" | while read name is status ; do boot="-" - hostname=`cat $(lxc_rootfs $name)/etc/hostname` - ip=`grep address $(lxc_rootfs $name)/etc/network/interfaces | sed 's/.*address //'` - test -z "$ip" && ip=`grep lxc.network.ipv4 /var/lib/lxc/$name/config | cut -d= -f2` test -s /var/lib/lxc/$name/on_boot && boot="boot" - echo "$name $status $boot $(lxc_rootfs $name) $ip $hostname" + echo "$name $status $boot $(lxc_rootfs $name) $(lxc_ip $name) $(lxc_hostname $name)" done ) | column -t }