| # Copyright 2014 The ChromiumOS Authors |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| description "Metrics collection daemon" |
| author "chromium-os-dev@chromium.org" |
| |
| # The metrics daemon is responsible for receiving and forwarding to |
| # chrome UMA statistics not produced by chrome. |
| |
| # Wait for the crash reporter to check whether the previous session |
| # ended abnormally. |
| start on stopped crash-boot-collect |
| stop on stopping system-services |
| respawn |
| |
| # metrics will update the next line to add -uploader for embedded builds. |
| env DAEMON_FLAGS="" |
| |
| # Make the metrics daemon killable, because if it has a leak it's better to |
| # restart it than to OOM-panic. |
| oom score 0 |
| # Let the daemon crash if it grows too much. "as" is "address space" (vm |
| # size). We expect a typical VM size of about 30MB for the daemon. |
| limit as 150000000 unlimited |
| |
| expect fork |
| pre-start script |
| # Remove metrics_daemon files with bad permissions. systemd-tmpfiles will not |
| # correct the permissions and ownership |
| # (https://github.com/systemd/systemd/issues/19618), so the easiest thing to |
| # do is delete the files and let metrics_daemon recreate the files with the |
| # correct owner/permission. |
| (/usr/bin/find /var/lib/metrics \( -name 'Platform.*' -o -name '*.cycle' \) \ |
| \( -not -user metrics -o -not -group metrics -o -not -perm 644 \) \ |
| -delete -print 2>&1 | logger -t metrics-init-cleanup) || true |
| end script |
| |
| exec minijail0 --config /usr/share/minijail/metrics_daemon.conf \ |
| /usr/bin/metrics_daemon --nodaemon ${DAEMON_FLAGS} |