| # Copyright 2021 The ChromiumOS Authors |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| description "Disk usage daemon for ChromeOS" |
| author "chromium-os-dev@chromium.org" |
| |
| start on started system-services |
| stop on stopping boot-services |
| |
| # Minijail forks off the desired process. |
| expect fork |
| |
| # If the job respawns 10 times in 10 seconds, stop trying. |
| respawn |
| respawn limit 10 10 |
| |
| # Let the daemon crash if it grows too much. |
| limit as 40000000 unlimited |
| # Allow spaced to be killed and restarted. Consumers of data from spaced |
| # (momentarily) be unable to get correct data. |
| oom score -100 |
| |
| pre-start script |
| # Check if boot-services is still running before starting spaced. |
| # This is to prevent new dbus-activated instances from getting started once |
| # the system is beginning to shut down. |
| if ! initctl status boot-services | grep -q running; then |
| logger -t "${UPSTART_JOB}" "ERROR: system services not running, quit." |
| stop |
| exit 0 |
| fi |
| end script |
| |
| exec minijail0 --config /usr/share/minijail/spaced.conf \ |
| -- /usr/sbin/spaced |
| |
| # Wait for daemon to claim its D-Bus name before transitioning to started. |
| post-start exec minijail0 -u spaced -g spaced /usr/bin/gdbus \ |
| wait --system --timeout 15 org.chromium.Spaced |