fi
}
+lxc_log() {
+ echo `date +%Y-%m-%dT%H:%M:%S` $*
+}
+
lxc_watchdog() {
name=$1
rootfs=$(lxc_rootfs $1)
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
;;
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"
}