| # 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 "Chrome OS user interface" |
| author "chromium-os-dev@chromium.org" |
| |
| # The ui job post-stop script depends on a variety of daemons to be |
| # up and running during shutdown. In general, those daemons run |
| # from jobs that use 'stop on stopping boot-services'. In general, |
| # if a job says 'stop on stopping fubar', the job's 'post-stop' |
| # script runs *after* the the main process for 'fubar' is already |
| # dead. So, to guarantee correct operation, the 'ui' job can't use |
| # 'stop on stopping boot-services'. |
| # |
| # We use this job to delay 'stopping boot-services' until after the |
| # 'ui' job cleans up. The basic operation is this: |
| # + The 'ui' job stop conditions prevent this job's 'started' |
| # event until the 'post-stop' script completes. |
| # + This job stops itself with its own 'started' event. |
| # + The 'stopping boot-services' event doesn't happen until |
| # all of the preceding steps complete. |
| |
| start on starting halt or starting reboot |
| stop on started pre-shutdown |
| |
| # Log that we're shutting down and why we're doing it before rsyslogd stops. |
| # |
| # If SHUTDOWN_REASON is unset, the request didn't come from powerd. This |
| # typically means that someone or something called |
| # shutdown/halt/poweroff/reboot/etc. directly. |
| # |
| # This message is scraped by Tast to diagnose reboots. Please do not change |
| # its format. |
| import SHUTDOWN_REASON |
| pre-start exec logger -t "${UPSTART_JOB}" \ |
| "Shutting down for ${JOB}: ${SHUTDOWN_REASON:-not-via-powerd}" |