150 |
|
|
151 |
lxc_watchdog() { |
lxc_watchdog() { |
152 |
name=$1 |
name=$1 |
153 |
|
cgroup=$(mount -t cgroup | awk '{ print $3 }') |
154 |
|
test -d "$cgroup/lxc/$1" && cgroup="$cgroup/lxc" |
155 |
rootfs=$(lxc_rootfs $1) |
rootfs=$(lxc_rootfs $1) |
156 |
run=$rootfs/var/run |
run=$rootfs/var/run |
157 |
test -L $run && run=$rootfs/`readlink $run` # recent Debian have symlink to /run |
test -L $run && run=$rootfs/`readlink $run` # recent Debian have symlink to /run |
158 |
cd $run || echo "can't cd watchdog into $run" |
cd $run || echo "can't cd watchdog into $run" |
159 |
|
|
160 |
while true; do |
while true; do |
161 |
tasks=`wc -l < /cgroup/${name}/tasks` |
tasks=`wc -l < $cgroup/${name}/tasks` |
162 |
stop_on=1 # init |
stop_on=1 # init |
163 |
sulogins=`lxc-ps --name $name | grep sulogin | wc -l` |
sulogins=`lxc-ps --name $name | grep sulogin | wc -l` |
164 |
if [ "$sulogins" -gt 0 ] ; then |
if [ "$sulogins" -gt 0 ] ; then |