/etc/init/system-watchdog.conf is in upstart-watchdog 0.4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | #
# Watch for jobs failing to respawn and hitting the respawn limit.
#
start on stopped RESULT="failed" PROCESS="respawn"
task
script
if [ -f /userdata/.writable_image ]; then
logger -t watchdog "'$JOB' (instance '$INSTANCE') hit respawn limit - not rebooting as rootfs is writable"
exit 0
else
last_reboot_file=/userdata/.last_watchdog_reboot
if [ -f ${last_reboot_file} ]; then
last_modified=`stat -c %Y ${last_reboot_file}`
current_time=`date +%s`
time_since_modified=`expr ${current_time} - ${last_modified}`
reboot_again_timeout=3600 # seconds in 1 hour
if [ ${time_since_modified} -ge ${reboot_again_timeout} ]; then
rm -f ${last_reboot_file}
else
logger -t watchdog "'$JOB' (instance '$INSTANCE') hit respawn limit - not rebooting as rebooted recently"
exit 0
fi
fi
if [ ! -f ${last_reboot_file} ]; then
logger -t watchdog "'$JOB' (instance '$INSTANCE') hit respawn limit - rebooting"
touch ${last_reboot_file}
exec reboot
fi
fi
end script
|