X-Git-Url: http://git.rot13.org/?p=sysadmin-cookbook;a=blobdiff_plain;f=recepies%2Flxc%2Flxc-watchdog.sh;h=a68d33bb1ac055acba840e723751d54c8fc3db22;hp=fb5a173e2f1d46161684d59147b9bf3e2b912d16;hb=132f2c88b2fb189b6fc60334792e125d470ee8d6;hpb=a5267cc7459f4a7e182018f750f731f8e17c3d2b diff --git a/recepies/lxc/lxc-watchdog.sh b/recepies/lxc/lxc-watchdog.sh index fb5a173..a68d33b 100755 --- a/recepies/lxc/lxc-watchdog.sh +++ b/recepies/lxc/lxc-watchdog.sh @@ -73,7 +73,7 @@ setup_inittab() { # let container respond to kill -SIGPWR inittab=$rootfs/etc/inittab - if ! grep "$add" ${inittab} >/dev/null ; then + if test -e $inittab && ! grep "$add" ${inittab} >/dev/null ; then grep -v "$remove" ${inittab} > ${inittab}.new echo $add >> ${inittab}.new mv ${inittab}.new ${inittab} @@ -111,6 +111,12 @@ lxc_stop() { lxc_start() { name=$1 + rootfs=$(lxc_rootfs $1) + + if [ ! -e $rootfs ] ; then + echo "ERROR $name rootfs $rootfs not found" + return + fi if ! lxc-info -n $name | grep RUNNING ; then lxc_log "$name start"