| # Copyright 2018 The ChromiumOS Authors | |
| # Use of this source code is governed by a BSD-style license that can be | |
| # found in the LICENSE file. | |
| description "Starts a command for reading from the kmsg FIFO." | |
| author "chromium-os-dev@chromium.org" | |
| stop on stop-arc-instance or stopping ui | |
| script | |
| logger -t "${UPSTART_JOB}" "Start arc-kmsg-logger" | |
| while true ; do | |
| # If logger fails, terminate the job. If it exits with 0 on EOF, respawn | |
| # the process after a short sleep. | |
| runcon u:r:cros_arc_kmsg_logger:s0 \ | |
| sudo -u android-root \ | |
| logger -t "${UPSTART_JOB}" --prio-prefix --file /run/arc/android.kmsg.fifo | |
| logger -t "${UPSTART_JOB}" "EOF detected, restarting" | |
| sleep 1 | |
| done | |
| end script | |
| post-stop exec logger -t "${UPSTART_JOB}" "Post-stop arc-kmsg-logger" |