| # Copyright 2023 The ChromiumOS Authors |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| description "Start the printscanmgr daemon" |
| author "chromium-os-dev@chromium.org" |
| |
| # This is started by D-Bus service activation through |
| # org.chromium.printscanmgr.service. |
| stop on stopping ui |
| |
| respawn |
| # If the job respawns 3 times in 10 seconds, stop trying. |
| respawn limit 3 10 |
| |
| # Process is not system-critical but other processes depend on it. |
| oom score -200 |
| |
| pre-start script |
| # Check if ui is still running before starting printscanmgr. |
| # This is to prevent new D-Bus-activated instances from getting started once |
| # the system is beginning to shut down. |
| if ! initctl status ui | grep -q running; then |
| stop |
| exit 0 |
| fi |
| end script |
| |
| # The printscanmgr executable starts two processes, one which continues as root |
| # with limited functionality, and the main printscanmgr process which sandboxes |
| # itself with libminijail. |
| exec /usr/bin/printscanmgr |
| |
| # Wait for the daemon to claim its D-Bus name before transitioning to started. |
| post-start exec minijail0 -u printscanmgr -g printscanmgr /usr/bin/gdbus \ |
| wait --system --timeout 15 org.chromium.printscanmgr |