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 |
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 |
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 |
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 |