#!/bin/sh # hwclock.sh Set and adjust the CMOS clock. # # Version: @(#)hwclock.sh 2.00 14-Dec-1998 miquels@cistron.nl # # Patches: # 2000-01-30 Henrique M. Holschuh <hmh@rcm.org.br> # - Minor cosmetic changes in an attempt to help new # users notice something IS changing their clocks # during startup/shutdown. # - Added comments to alert users of hwclock issues # and discourage tampering without proper doc reading. # 2012-02-16 Roger Leigh <rleigh@debian.org> # - Use the UTC/LOCAL setting in /etc/adjtime rather than # the UTC setting in /etc/default/rcS. Additionally # source /etc/default/hwclock to permit configuration. ### BEGIN INIT INFO # Provides: hwclock # Required-Start: mountdevsubfs # Required-Stop: mountdevsubfs # Should-Stop: umountfs # Default-Start: S # X-Start-Before: checkroot # Default-Stop: 0 6 # Short-Description: Sync hardware and system clock time. ### END INIT INFO # These defaults are user-overridable in /etc/default/hwclock BADYEAR=no HWCLOCKACCESS=yes HWCLOCKPARS= HCTOSYS_DEVICE=rtc0 # We only want to use the system timezone or else we'll get # potential inconsistency at startup. unset TZ hwclocksh() { [ ! -x /sbin/hwclock ] && return 0 [ ! -r /etc/default/rcS ] || . /etc/default/rcS [ ! -r /etc/default/hwclock ] || . /etc/default/hwclock . /lib/lsb/init-functions verbose_log_action_msg() { [ "$VERBOSE" = no ] || log_action_msg "$@"; } case "$BADYEAR" in no|"") BADYEAR="" ;; yes) BADYEAR="--badyear" ;; *) log_action_msg "unknown BADYEAR setting: \"$BADYEAR\""; return 1 ;; esac case "$1" in start) # If the admin deleted the hwclock config, create a blank # template with the defaults. if [ -w /etc ] && [ ! -f /etc/adjtime ] && [ ! -e /etc/adjtime ]; then printf "0.0 0 0.0\n0\nUTC\n" > /etc/adjtime fi if [ -d /run/udev ] || [ -d /dev/.udev ]; then return 0 fi if [ "$HWCLOCKACCESS" != no ]; then log_action_msg "Setting the system clock" # Just for reporting. if sed '3!d' /etc/adjtime | grep -q '^UTC$'; then UTC="--utc" else UTC= fi # Copies Hardware Clock time to System Clock using the correct # timezone for hardware clocks in local time, and sets kernel # timezone. DO NOT REMOVE. if /sbin/hwclock --rtc=/dev/$HCTOSYS_DEVICE --hctosys $HWCLOCKPARS $BADYEAR; then # Announce the local time. verbose_log_action_msg "System Clock set to: `date $UTC`" else log_warning_msg "Unable to set System Clock to: `date $UTC`" fi else verbose_log_action_msg "Not setting System Clock" fi ;; stop|restart|reload|force-reload) # # Updates the Hardware Clock with the System Clock time. # This will *override* any changes made to the Hardware Clock. # # WARNING: If you disable this, any changes to the system # clock will not be carried across reboots. # if [ "$HWCLOCKACCESS" != no ]; then log_action_msg "Saving the system clock" if /sbin/hwclock --rtc=/dev/$HCTOSYS_DEVICE --systohc $HWCLOCKPARS $BADYEAR; then verbose_log_action_msg "Hardware Clock updated to `date`" fi else verbose_log_action_msg "Not saving System Clock" fi ;; show) if [ "$HWCLOCKACCESS" != no ]; then /sbin/hwclock --rtc=/dev/$HCTOSYS_DEVICE --show $HWCLOCKPARS $BADYEAR fi ;; *) log_success_msg "Usage: hwclock.sh {start|stop|reload|force-reload|show}" log_success_msg " start sets kernel (system) clock from hardware (RTC) clock" log_success_msg " stop and reload set hardware (RTC) clock from kernel (system) clock" return 1 ;; esac } hwclocksh "$@"
Name | Type | Size | Permission | Actions |
---|---|---|---|---|
acpid | File | 2.22 KB | 0755 |
|
apache-htcacheclean | File | 2.43 KB | 0755 |
|
apache2 | File | 7.99 KB | 0755 |
|
apparmor | File | 4.23 KB | 0755 |
|
apport | File | 2.85 KB | 0755 |
|
atd | File | 1.05 KB | 0755 |
|
cgroupfs-mount | File | 1.86 KB | 0755 |
|
console-setup.sh | File | 1.2 KB | 0755 |
|
cron | File | 2.98 KB | 0755 |
|
cryptdisks | File | 937 B | 0755 |
|
cryptdisks-early | File | 978 B | 0755 |
|
danted | File | 3.72 KB | 0755 |
|
dbus | File | 2.75 KB | 0755 |
|
docker | File | 3.42 KB | 0755 |
|
ebtables | File | 4.38 KB | 0755 |
|
grub-common | File | 985 B | 0755 |
|
hddtemp | File | 2.99 KB | 0755 |
|
hwclock.sh | File | 3.72 KB | 0755 |
|
irqbalance | File | 2.39 KB | 0755 |
|
iscsid | File | 1.47 KB | 0755 |
|
keyboard-setup.sh | File | 1.44 KB | 0755 |
|
kmod | File | 2 KB | 0755 |
|
lm-sensors | File | 883 B | 0755 |
|
lvm2 | File | 695 B | 0755 |
|
lvm2-lvmetad | File | 571 B | 0755 |
|
lvm2-lvmpolld | File | 586 B | 0755 |
|
lxcfs | File | 2.32 KB | 0755 |
|
lxd | File | 2.19 KB | 0755 |
|
mdadm | File | 2.59 KB | 0755 |
|
mdadm-waitidle | File | 1.22 KB | 0755 |
|
mysql | File | 5.48 KB | 0755 |
|
netfilter-persistent | File | 1.33 KB | 0755 |
|
network-manager | File | 1.9 KB | 0755 |
|
open-iscsi | File | 2.44 KB | 0755 |
|
open-vm-tools | File | 1.8 KB | 0755 |
|
openvpn | File | 8.92 KB | 0755 |
|
plymouth | File | 1.33 KB | 0755 |
|
plymouth-log | File | 752 B | 0755 |
|
pppd-dns | File | 612 B | 0755 |
|
procps | File | 1.16 KB | 0755 |
|
rsync | File | 4.25 KB | 0755 |
|
rsyslog | File | 2.8 KB | 0755 |
|
screen-cleanup | File | 1.19 KB | 0755 |
|
ssh | File | 3.75 KB | 0755 |
|
tor | File | 5.92 KB | 0755 |
|
ubuntu-fan | File | 1.2 KB | 0755 |
|
udev | File | 5.83 KB | 0755 |
|
ufw | File | 2.03 KB | 0755 |
|
unattended-upgrades | File | 1.36 KB | 0755 |
|
uuidd | File | 1.28 KB | 0755 |
|
x11-common | File | 2.69 KB | 0755 |
|