From fd7cdfdcd9997411709bbf03322d6b3172fc0955 Mon Sep 17 00:00:00 2001 From: Keith Whyte Date: Thu, 26 Jan 2023 01:07:29 +0100 Subject: [PATCH] Add hack to set correct date with GPS The GPS unit has a problem with rollover and is 1024 weeks behind, so bump the date forward after gpsdate sets it --- modules/rhizo_base/files/SysmoBTS/gpsdate.service | 11 +++++++++++ modules/rhizo_base/files/SysmoBTS/provision.sh | 1 + 2 files changed, 12 insertions(+) create mode 100644 modules/rhizo_base/files/SysmoBTS/gpsdate.service diff --git a/modules/rhizo_base/files/SysmoBTS/gpsdate.service b/modules/rhizo_base/files/SysmoBTS/gpsdate.service new file mode 100644 index 0000000..bfdf95c --- /dev/null +++ b/modules/rhizo_base/files/SysmoBTS/gpsdate.service @@ -0,0 +1,11 @@ +[Unit] +Description=Set time based on GPS + +[Service] +Type=simple +EnvironmentFile=/etc/default/gpsdate +ExecStart=/usr/sbin/gpsdate --no-detach ${GPSDATE_HOST} ${GPSDATE_PORT} +ExecStopPost=/bin/bash -c "sleep 1; date $(date +%%m%%d%%H%%M%%Y.%%S -d \"+1024 weeks\")" + +[Install] +WantedBy=multi-user.target diff --git a/modules/rhizo_base/files/SysmoBTS/provision.sh b/modules/rhizo_base/files/SysmoBTS/provision.sh index e63669a..39439ba 100644 --- a/modules/rhizo_base/files/SysmoBTS/provision.sh +++ b/modules/rhizo_base/files/SysmoBTS/provision.sh @@ -56,6 +56,7 @@ for bts in "${!BTS[@]}" ; do ssh $SSH_OPTS root@${BTS[$bts]} "echo '$SITE-$bts' > /etc/hostname" scp $SSH_OPTS master/gpsd root@${BTS[$bts]}:/etc/default/gpsd scp $SSH_OPTS master/ntp.conf root@${BTS[$bts]}:/etc/ntp.conf + scp $SSH_OPTS gpsdate.service root@${BTS[$bts]}:/lib/systemd/system fi if [ "$_trxNR" == "0" ] ; then