Added ntp
The script that the ntp systemd service executed is a SysVinit script that used PIDs, but due to pid-guessing it's prone to failure by design. See http://smarden.org/runit/benefits.html The run script of this runit service was altered from that SysVinit script to run in the foreground. SysVinit scripts are long,verbose, and complex which is a shame, because it scared people from init scripts in general. Runit scripts are very simple, as they just alter the environment if necessary, before exec'ing into the service. They rarely take more than a couple lines.
This commit is contained in:
parent
02d1ca6c19
commit
e0b5e07371
1 changed files with 19 additions and 0 deletions
19
sv/ntp/run
Normal file
19
sv/ntp/run
Normal file
|
@ -0,0 +1,19 @@
|
|||
#!/bin/sh
|
||||
sv start networking
|
||||
sv stop systemd-timesyncd
|
||||
DAEMON=/usr/sbin/ntpd
|
||||
if [ -r /etc/default/ntp ]; then
|
||||
. /etc/default/ntp
|
||||
fi
|
||||
|
||||
if [ -e /run/ntp.conf.dhcp ]; then
|
||||
NTPD_OPTS="$NTPD_OPTS -c /run/ntp.conf.dhcp"
|
||||
fi
|
||||
|
||||
RUNASUSER=ntp
|
||||
UGID=$(getent passwd $RUNASUSER | cut -f 3,4 -d:) || true
|
||||
|
||||
if test "$(uname -s)" = "Linux"; then
|
||||
NTPD_OPTS="$NTPD_OPTS -u $UGID"
|
||||
fi
|
||||
exec $DAEMON --nofork $NTP_OPTS
|
Loading…
Reference in a new issue