--- recepies/lxc/lxc-watchdog.sh 2010/03/16 20:53:59 186 +++ recepies/lxc/lxc-watchdog.sh 2010/03/16 21:36:45 187 @@ -105,6 +105,10 @@ fi } +lxc_log() { + echo `date +%Y-%m-%dT%H:%M:%S` $* +} + lxc_watchdog() { name=$1 rootfs=$(lxc_rootfs $1) @@ -116,20 +120,20 @@ if [ "$tasks" -eq 1 ]; then runlevel="$(runlevel ${vps_utmp})" - echo `date +%Y-%m-%dT%H:%M:%S` "$name runlevel $runlevel" + lxc_log "$name runlevel $runlevel" case $runlevel in N*) # nothing for new boot state ;; ??0) - echo "$name halt" + lxc_log "$name halt" lxc-stop -n "${name}" lxc-wait -n ${name} -s STOPPED break ;; ??6) - echo "$name reboot"; + lxc_log "$name reboot"; lxc-stop -n ${name} lxc-wait -n ${name} -s STOPPED lxc-start -d -n ${name} -o /tmp/${name}.log @@ -141,14 +145,14 @@ ;; esac else - echo "# $name $tasks tasks" + lxc_log "$name $tasks tasks" fi # time of 5 minutes on it JUST IN CASE... inotifywait -qqt 300 ${vps_utmp} done -echo "${name} exited" +lxc_log "$name exited" }