| # Copyright (c) 2014 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 "Remove all bootstat data except the most recent" |
| author "chromium-os-dev@chromium.org" |
| |
| start on started system-services |
| |
| script |
| # Every time we shut down, we save a log of all the bootstat event |
| # files. To prevent unbounded growth, when we get back here, we |
| # remove the data for all but the 50 most recent boots. |
| for log in $(ls -t /var/log/metrics/ | |
| grep '^shutdown\.[0-9]*$' | |
| tail -n +51); do |
| rm -rf "/var/log/metrics/${log}" || : |
| done |
| end script |