Sheba, the realm of Tux
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

37 lines
1.1 KiB

#!/bin/sh
# --- SDE-COPYRIGHT-NOTE-BEGIN ---
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
#
# Filename: target/sheba/pkgs/clockspeed/D%sysconfdir_clockspeed_clockspeed-adjust_run.sh
# Copyright (C) 2008 The OpenSDE Project
#
# More information can be found in the files COPYING and README.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License. A copy of the
# GNU General Public License can be found in the file COPYING.
# --- SDE-COPYRIGHT-NOTE-END ---
# based on http://www.thedjbway.org/clocksd/index.html
exec 2>&1
WAIT=$( expr 9 \* 3600 ) # first in 9 hours
WAIT_MAX=$( expr 7 \* 24 \* 3600 ) # at least once per week
# loop indefinitely
while true; do
echo "Waiting ${WAIT} seconds until next adjustment..."
sleep ${WAIT}
# obtain timing mark for calibrating clockspeed adjust:
clockctl mark
# log current "attoseconds":
clockctl atto
echo "==="
if [ $WAIT -lt $WAIT_MAX ]; then
WAIT=$( expr $WAIT \* 2 )
[ $WAIT -le $WAIT_MAX ] || WAIT=$WAIT_MAX
fi
done