/[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 189 by dpavlin, Tue Mar 16 23:05:31 2010 UTC revision 190 by root, Tue Mar 16 23:14:38 2010 UTC
# Line 16  Line 16 
16  #  #
17  # based on Tony Risinger post to lxc-users mailing list  # based on Tony Risinger post to lxc-users mailing list
18  # http://www.mail-archive.com/lxc-users@lists.sourceforge.net/msg00074.html  # http://www.mail-archive.com/lxc-users@lists.sourceforge.net/msg00074.html
19    #
20    # Install with:
21    # ln -sf /srv/sysadmin-cookbook/recepies/lxc/lxc-watchdog.sh /etc/init.d/lxc-watchdog
22    # update-rc.d lxc-watchdog defaults
23    
24    
25  which inotifywait >/dev/null || apt-get install inotify-tools  which inotifywait >/dev/null || apt-get install inotify-tools
# Line 160  lxc_log "$name watchdog exited" Line 164  lxc_log "$name watchdog exited"
164  }  }
165    
166    
167    usage() {
168            echo "Usage: $0 {start|stop|restart|status|boot|disable} [name name ... ]" >&2
169            exit 3
170    }
171    
172  command_on_lxc() {  command_on_lxc() {
173  command=$1  command=$1
174  shift  shift
# Line 194  disable) Line 203  disable)
203          echo -n > /var/lib/lxc/$1/on_boot          echo -n > /var/lib/lxc/$1/on_boot
204          ;;          ;;
205  *)  *)
206          echo "Usage: $0 {start|stop|restart|status}" >&2          usage
         exit 3  
207          ;;          ;;
208    
209  esac  esac
# Line 203  esac Line 211  esac
211  }  }
212    
213  command=$1  command=$1
214  shift  test -z "$command" && usage
   
215  test "$command" = "status" && lxc_status && exit  test "$command" = "status" && lxc_status && exit
216    shift
217    
218  if [ -z "$1" ] ; then  if [ -z "$1" ] ; then
219          ls /var/lib/lxc/*/on_boot | while read path ; do          ls /var/lib/lxc/*/on_boot | while read path ; do

Legend:
Removed from v.189  
changed lines
  Added in v.190

  ViewVC Help
Powered by ViewVC 1.1.26