xref: /openbmc/openbmc/poky/meta/recipes-core/initscripts/initscripts-1.0/save-rtc.sh (revision 45852739b8823d99a818e714b72961886759fe2e)
1#!/bin/sh
2#
3# SPDX-License-Identifier: GPL-2.0-only
4#
5
6### BEGIN INIT INFO
7# Provides:          save-rtc
8# Required-Start:
9# Required-Stop:     $local_fs hwclock
10# Default-Start:     S
11# Default-Stop:      0 6
12# Short-Description: Store system clock into file
13# Description:
14### END INIT INFO
15
16TIMESTAMP_FILE=/etc/timestamp
17
18[ -f /etc/default/timestamp ] && . /etc/default/timestamp
19
20# Update the timestamp
21date -u +%4Y%2m%2d%2H%2M%2S 2>/dev/null > "$TIMESTAMP_FILE"
22