| # Copyright 2020 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 "Record the boot time and boot id." |
| author "chromium-os-dev@chromium.org" |
| |
| start on started syslog |
| task |
| |
| script |
| BOOT_TIME=`date --date "$(uptime -s)" '+%Y-%m-%dT%H:%M:%S.000000%:z'` |
| BOOT_ID=`cat /proc/sys/kernel/random/boot_id | tr -d "-"` |
| echo "${BOOT_TIME} INFO boot_id: ${BOOT_ID}" >> /var/log/boot_id.log |
| |
| # Keep the last 500 entries. |
| echo "$(tail -500 /var/log/boot_id.log)" > /var/log/boot_id.log |
| end script |