blob: 76d015f216bbeee188d48265455d9ccdaf082656 [file] [log] [blame]
# Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
description "Simple Watchdog daemon"
author "chromium-os-dev@chromium.org"
start on started boot-services
stop on stopping boot-services
respawn
expect fork
env minijail_common_args="-I -p -e -l -r -v \
-u watchdog -g watchdog \
-- /usr/sbin/daisydog"
pre-start script
# We need the check command to *not* background/exit early, so do not pass
# in the -i flag to it. This way we can capture its output and exit status.
check_cmd() {
/sbin/minijail0 ${minijail_common_args} -c
}
# Run in "check" mode to determine if the last reset was because
# of a watchdog timeout.
if check_cmd | grep -Fq "watchdog-timeout"; then
metrics_client -v HwWatchdogReboot
fi
end script
exec chrt -r 99 /sbin/minijail0 -i ${minijail_common_args}