/[sysadmin-cookbook]/recepies/lxc/lxc-watchdog.sh
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /recepies/lxc/lxc-watchdog.sh

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 300 by dpavlin, Tue Dec 13 12:54:24 2011 UTC revision 301 by dpavlin, Tue Apr 9 19:49:31 2013 UTC
# Line 150  lxc_start() { Line 150  lxc_start() {
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

Legend:
Removed from v.300  
changed lines
  Added in v.301

  ViewVC Help
Powered by ViewVC 1.1.26