|
From: <abe...@us...> - 2012-09-27 03:40:02
|
Revision: 5694
http://astlinux.svn.sourceforge.net/astlinux/?rev=5694&view=rev
Author: abelbeck
Date: 2012-09-27 03:39:56 +0000 (Thu, 27 Sep 2012)
Log Message:
-----------
ntp, when ntpd fails to startup when the server is unreachable it will now automatically retry via a background process
Modified Paths:
--------------
branches/1.0/package/ntp/ntpd.init
Modified: branches/1.0/package/ntp/ntpd.init
===================================================================
--- branches/1.0/package/ntp/ntpd.init 2012-09-24 15:33:34 UTC (rev 5693)
+++ branches/1.0/package/ntp/ntpd.init 2012-09-27 03:39:56 UTC (rev 5694)
@@ -50,26 +50,36 @@
}
start () {
+ local NTPAF="" first
+
if [ -f /etc/ntpd.conf ]; then
- local NTPAF
if [ "$IPV6" != "yes" ]; then
NTPAF="-4"
fi
echo "Starting ntpd..."
- if [ -n "$EXTIP" -a -n "$DNS" -o -r /tmp/mydhcpip -o -r /etc/ppp/pppoe.conf ]; then
- local first=`awk '/^server / { print $2; nextfile; }' /etc/ntpd.conf`
+ first="$(awk '/^server / { print $2; nextfile; }' /etc/ntpd.conf)"
+ if [ -n "$first" ]; then
- if nslookup $first >/dev/null; then
- # Set the clock (large change) and exit
- sntp $NTPAF -s -t4 $first
- if [ $? -eq 0 -a -r /dev/rtc ]; then
+ # Set the clock (large change)
+ if sntp $NTPAF -s -t4 $first; then
+ if [ -r /dev/rtc ]; then
hwclock -wu --noadjfile 2>/dev/null
fi
sleep 1
# Maintain the clock (small changes)
ntpd $NTPAF -g -c /etc/ntpd.conf
+ elif ( set -o noclobber; echo "$$" > /var/lock/ntpd-delayed.lock ) 2>/dev/null; then
+ echo "ntpd: server unreachable, will automatically retry in 2 minutes"
+ (
+ sleep 120
+ while [ ! -f /var/run/ntpd.pid ]; do
+ service ntpd start
+ sleep 300
+ done
+ rm -f /var/lock/ntpd-delayed.lock
+ ) >/dev/null 2>&1 &
fi
fi
fi
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <abe...@us...> - 2015-05-11 23:29:58
|
Revision: 7065
http://sourceforge.net/p/astlinux/code/7065
Author: abelbeck
Date: 2015-05-11 23:29:55 +0000 (Mon, 11 May 2015)
Log Message:
-----------
ntp, ntpd init script, for sntp (large change) use -S instead of -s which uses settimeofday(2) instead of adjtime(2). Previously using -s the needed change could be out of range for adjtime(2) with the error 'adj_systime: Invalid argument'
Modified Paths:
--------------
branches/1.0/package/ntp/ntpd.init
Modified: branches/1.0/package/ntp/ntpd.init
===================================================================
--- branches/1.0/package/ntp/ntpd.init 2015-05-08 01:20:02 UTC (rev 7064)
+++ branches/1.0/package/ntp/ntpd.init 2015-05-11 23:29:55 UTC (rev 7065)
@@ -63,7 +63,7 @@
if [ -n "$first" ]; then
# Set the clock (large change)
- if sntp $NTPAF -s -t4 $first; then
+ if sntp $NTPAF -S -t4 $first; then
if [ -r /dev/rtc ]; then
hwclock -wu --noadjfile 2>/dev/null
fi
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <abe...@us...> - 2016-11-28 14:09:49
|
Revision: 7994
http://sourceforge.net/p/astlinux/code/7994
Author: abelbeck
Date: 2016-11-28 14:09:47 +0000 (Mon, 28 Nov 2016)
Log Message:
-----------
ntp, ntpd: move the PIDFILE out of the config file since we depend on it being /var/run/ntpd.pid
Modified Paths:
--------------
branches/1.0/package/ntp/ntpd.init
Modified: branches/1.0/package/ntp/ntpd.init
===================================================================
--- branches/1.0/package/ntp/ntpd.init 2016-11-27 00:58:52 UTC (rev 7993)
+++ branches/1.0/package/ntp/ntpd.init 2016-11-28 14:09:47 UTC (rev 7994)
@@ -2,6 +2,8 @@
. /etc/rc.conf
+PIDFILE="/var/run/ntpd.pid"
+
init () {
# So sntp doesn't complain
@@ -20,7 +22,6 @@
fi
echo "# Autogenerated. Do not edit.
-pidfile /var/run/ntpd.pid
driftfile /var/lib/ntp/ntpd.drift
restrict default noquery nopeer notrap nomodify
@@ -74,12 +75,12 @@
fi
sleep 1
# Maintain the clock (small changes)
- ntpd $NTPAF -u ntp:ntp -g -c /etc/ntpd.conf
+ ntpd $NTPAF -p $PIDFILE -u ntp:ntp -g -c /etc/ntpd.conf
elif ( set -o noclobber; echo "$$" > /var/lock/ntpd-delayed.lock ) 2>/dev/null; then
echo "ntpd: server unreachable, will automatically retry in 2 minutes"
(
sleep 120
- while [ ! -f /var/run/ntpd.pid ]; do
+ while [ ! -f $PIDFILE ]; do
service ntpd start
sleep 300
done
@@ -92,10 +93,10 @@
stop () {
- if [ -f /var/run/ntpd.pid ]; then
+ if [ -f $PIDFILE ]; then
echo "Stopping ntpd..."
- kill $(cat /var/run/ntpd.pid) >/dev/null 2>&1
- rm -f /var/run/ntpd.pid
+ kill $(cat $PIDFILE) >/dev/null 2>&1
+ rm -f $PIDFILE
fi
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <abe...@us...> - 2016-11-29 14:54:46
|
Revision: 7997
http://sourceforge.net/p/astlinux/code/7997
Author: abelbeck
Date: 2016-11-29 14:54:44 +0000 (Tue, 29 Nov 2016)
Log Message:
-----------
ntp, ntpd: workaround restart lockup, start ntpd with 'ntp' privileges at boot, then restart as 'root'
Modified Paths:
--------------
branches/1.0/package/ntp/ntpd.init
Modified: branches/1.0/package/ntp/ntpd.init
===================================================================
--- branches/1.0/package/ntp/ntpd.init 2016-11-28 22:35:55 UTC (rev 7996)
+++ branches/1.0/package/ntp/ntpd.init 2016-11-29 14:54:44 UTC (rev 7997)
@@ -4,14 +4,18 @@
PIDFILE="/var/run/ntpd.pid"
+DATA_DIR="/var/lib/ntp"
+
+NTPD_STARTED="$DATA_DIR/ntpd_started"
+
init () {
# So sntp doesn't complain
touch /var/db/ntp-kod
- if [ ! -d /var/lib/ntp ]; then
- mkdir -m 0700 -p /var/lib/ntp
- chown ntp:ntp /var/lib/ntp
+ if [ ! -d $DATA_DIR ]; then
+ mkdir -m 0700 -p $DATA_DIR
+ chown ntp:ntp $DATA_DIR
fi
if [ -f /mnt/kd/ntpd.conf ]; then
@@ -22,7 +26,7 @@
fi
echo "# Autogenerated. Do not edit.
-driftfile /var/lib/ntp/ntpd.drift
+driftfile $DATA_DIR/ntpd.drift
restrict default noquery nopeer notrap nomodify
restrict 127.0.0.1" > /tmp/etc/ntpd.conf
@@ -56,7 +60,7 @@
}
start () {
- local NTPAF="" first
+ local NTPAF="" UG first driftfile
if [ -f /etc/ntpd.conf ]; then
@@ -74,8 +78,21 @@
hwclock -wu --noadjfile 2>/dev/null
fi
sleep 1
+
+ # workaround restart lockup, start ntpd with 'ntp' privileges at boot, then restart as 'root'
+ if [ -f $NTPD_STARTED ]; then
+ UG=""
+ else
+ UG="ntp:ntp"
+ driftfile="$(awk '/^driftfile / { print $2; nextfile; }' /etc/ntpd.conf)"
+ if [ -n "$driftfile" ] && [ -f "$driftfile" ]; then
+ chown $UG "$driftfile"
+ fi
+ fi
# Maintain the clock (small changes)
- ntpd $NTPAF -p $PIDFILE -u ntp:ntp -g -c /etc/ntpd.conf
+ ntpd $NTPAF -p $PIDFILE${UG:+ -u $UG} -g -c /etc/ntpd.conf
+
+ touch $NTPD_STARTED
elif ( set -o noclobber; echo "$$" > /var/lock/ntpd-delayed.lock ) 2>/dev/null; then
echo "ntpd: server unreachable, will automatically retry in 2 minutes"
(
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <abe...@us...> - 2016-11-29 17:42:00
|
Revision: 8001
http://sourceforge.net/p/astlinux/code/8001
Author: abelbeck
Date: 2016-11-29 17:41:57 +0000 (Tue, 29 Nov 2016)
Log Message:
-----------
ntp, ntpd: workaround restart lockup, can't start ntpd with 'ntp' privileges
Modified Paths:
--------------
branches/1.0/package/ntp/ntpd.init
Modified: branches/1.0/package/ntp/ntpd.init
===================================================================
--- branches/1.0/package/ntp/ntpd.init 2016-11-29 15:31:12 UTC (rev 8000)
+++ branches/1.0/package/ntp/ntpd.init 2016-11-29 17:41:57 UTC (rev 8001)
@@ -6,8 +6,6 @@
DATA_DIR="/var/lib/ntp"
-NTPD_STARTED="$DATA_DIR/ntpd_started"
-
init () {
# So sntp doesn't complain
@@ -60,7 +58,7 @@
}
start () {
- local NTPAF="" UG first driftfile
+ local NTPAF="" UG="" first
if [ -f /etc/ntpd.conf ]; then
@@ -79,20 +77,10 @@
fi
sleep 1
- # workaround restart lockup, start ntpd with 'ntp' privileges at boot, then restart as 'root'
- if [ -f $NTPD_STARTED ]; then
- UG=""
- else
- UG="ntp:ntp"
- driftfile="$(awk '/^driftfile / { print $2; nextfile; }' /etc/ntpd.conf)"
- if [ -n "$driftfile" ] && [ -f "$driftfile" ]; then
- chown $UG "$driftfile"
- fi
- fi
+ ## workaround restart lockup, can't start ntpd with 'ntp' privileges
+ ## UG="ntp:ntp"
# Maintain the clock (small changes)
ntpd $NTPAF -p $PIDFILE${UG:+ -u $UG} -g -c /etc/ntpd.conf
-
- touch $NTPD_STARTED
elif ( set -o noclobber; echo "$$" > /var/lock/ntpd-delayed.lock ) 2>/dev/null; then
echo "ntpd: server unreachable, will automatically retry in 2 minutes"
(
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|