blob: c45293cee9363f278d939cf7a55b2bb9f09fc277 [file] [log] [blame]
# Copyright 2018 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 "Log all the moblab upstart events to aid debugging."
author "chromium-os-dev@chromium.org"
# Disable OOM killer, critical for debugging issues.
oom score never
start on (starting moblab* or started moblab* or stopping moblab* or stopped moblab*)
env LOGDIR="/var/log/bootup/"
normal exit 0
task
script
if [ -d "${LOGDIR}" ]; then
mkdir -p "${LOGDIR}"
fi
exec >>${LOGDIR}${UPSTART_JOB}.log 2>&1
DS=`date +%s%N`
log="${DS}\t\t$JOB\t\t\t${UPSTART_EVENTS}\t\t"
if [ "${RESULT}" = "failed" ]; then
log="${log}\t\tprocess $PROCESS"
fi
if [ -n "${RESULT}" ]; then
log="${log}\t\tresult $RESULT"
fi
if [ -n "${EXIT_STATUS}" ]; then
log="${log}\t\texit_code $EXIT_STATUS"
fi
if [ -n "${EXIT_SIGNAL}" ]; then
log="${log}\t\texit_signal $EXIT_SIGNAL"
fi
echo "${log}"
end script