use lxc-ps to find container's init
authorDobrica Pavlinusic <dpavlin@rot13.org>
Tue, 16 Mar 2010 16:18:40 +0000 (16:18 +0000)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Tue, 16 Mar 2010 16:18:40 +0000 (16:18 +0000)
git-svn-id: svn://svn.rot13.org/sysadmin-cookbook@180 191e9f34-6774-4a6d-acfc-7664dacd4a2a

recepies/lxc/lxc-watchdog.sh

index 97ab178..7d0b0cd 100755 (executable)
@@ -38,7 +38,7 @@ fi
 
 if [ "$2" == "stop" ] ; then
        echo "$name stop"
-       kill -SIGPWR `head -1 /cgroup/$name/tasks`
+       kill -SIGPWR `lxc-ps -C init -o pid | grep "^$name" | cut -d" " -f2-`
        lxc-wait -n $name -s STOPPED
        exit
 fi