--- recepies/lxc/lxc-watchdog.sh 2010/03/16 23:05:31 189 +++ recepies/lxc/lxc-watchdog.sh 2010/03/16 23:14:38 190 @@ -16,6 +16,10 @@ # # based on Tony Risinger post to lxc-users mailing list # http://www.mail-archive.com/lxc-users@lists.sourceforge.net/msg00074.html +# +# Install with: +# ln -sf /srv/sysadmin-cookbook/recepies/lxc/lxc-watchdog.sh /etc/init.d/lxc-watchdog +# update-rc.d lxc-watchdog defaults which inotifywait >/dev/null || apt-get install inotify-tools @@ -160,6 +164,11 @@ } +usage() { + echo "Usage: $0 {start|stop|restart|status|boot|disable} [name name ... ]" >&2 + exit 3 +} + command_on_lxc() { command=$1 shift @@ -194,8 +203,7 @@ echo -n > /var/lib/lxc/$1/on_boot ;; *) - echo "Usage: $0 {start|stop|restart|status}" >&2 - exit 3 + usage ;; esac @@ -203,9 +211,9 @@ } command=$1 -shift - +test -z "$command" && usage test "$command" = "status" && lxc_status && exit +shift if [ -z "$1" ] ; then ls /var/lib/lxc/*/on_boot | while read path ; do