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:
AwesomeAdam54321 2021-06-20 07:29:56 +02:00
parent 02d1ca6c19
commit e0b5e07371

19
sv/ntp/run Normal file
View 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