#!/bin/bash # save-time version #VERSION# # Save the time upon shutdown for seeding system clock on next boot. # This is intended to give roughly correct system time on machines # without rtc, but which are powered on most of the time. case "$1" in 'start') if [ -f '#CACHEDIR#/time' ]; then date -s@"$(cat '#CACHEDIR#/time')" fi ;; 'stop') date +%s > '#CACHEDIR#/time' ;; *) >&2 echo "usage: ${0##*/} (start|stop)" exit 1 ;; esac