From e05a61133245052ad9f84f857e5052679a672fb8 Mon Sep 17 00:00:00 2001 From: Dobrica Pavlinusic Date: Tue, 16 Mar 2010 23:14:38 +0000 Subject: [PATCH] better usage, install as init script docs git-svn-id: svn://svn.rot13.org/sysadmin-cookbook@190 191e9f34-6774-4a6d-acfc-7664dacd4a2a --- recepies/lxc/lxc-watchdog.sh | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/recepies/lxc/lxc-watchdog.sh b/recepies/lxc/lxc-watchdog.sh index 8c3a77d..d003f2f 100755 --- a/recepies/lxc/lxc-watchdog.sh +++ b/recepies/lxc/lxc-watchdog.sh @@ -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 @@ lxc_log "$name watchdog exited" } +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 @@ disable) echo -n > /var/lib/lxc/$1/on_boot ;; *) - echo "Usage: $0 {start|stop|restart|status}" >&2 - exit 3 + usage ;; esac @@ -203,9 +211,9 @@ esac } 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 -- 2.20.1