| # Copyright 2021 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 satlab upstart events to aid debugging." |
| author "chromium-os-dev@chromium.org" |
| |
| start on (starting satlab* or |
| started satlab* or |
| stopping satlab* or |
| stopped satlab* or |
| 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 |