mirror of
git://slackware.nl/current.git
synced 2024-12-29 10:25:00 +01:00
e5301d4448
patches/packages/ntp-4.2.8p18-x86_64-2_slack15.0.txz: Rebuilt. This is a bugfix release to fix a possible regression. In some cases ntpd gets an error on mixed ipv4/ipv6 networks, so we'll make it possible to easily configure ntpd to use ipv4 only or ipv6 only (as well as to change any other ntpd options). rc.ntp: properly create the PID file on start. Add /etc/default/ntp to configure ntpd startup options since some people are needing to add -4 to avoid an error. Thanks to rkelsen and teoberi.
59 lines
907 B
Bash
59 lines
907 B
Bash
#!/bin/sh
|
|
# Start/stop/restart ntpd.
|
|
|
|
# Load options from /etc/default/ntp:
|
|
. /etc/default/ntp
|
|
|
|
# Start ntpd:
|
|
ntpd_start() {
|
|
echo -n "Starting NTP daemon: /usr/sbin/ntpd $NTPD_OPTS"
|
|
/usr/sbin/ntpd $NTPD_OPTS
|
|
echo
|
|
}
|
|
|
|
# Stop ntpd:
|
|
ntpd_stop() {
|
|
echo -n "Stopping NTP daemon... "
|
|
if [ -r /run/ntpd.pid ]; then
|
|
echo -n "(PID $(cat /run/ntpd.pid))"
|
|
kill -HUP $(cat /run/ntpd.pid)
|
|
rm -f /run/ntpd.pid
|
|
else
|
|
killall --ns $$ -HUP -q ntpd
|
|
fi
|
|
echo
|
|
}
|
|
|
|
# Restart ntpd:
|
|
ntpd_restart() {
|
|
ntpd_stop
|
|
sleep 1
|
|
ntpd_start
|
|
}
|
|
|
|
# Check if ntpd is running
|
|
ntpd_status() {
|
|
if [ -e /run/ntpd.pid ]; then
|
|
echo "ntpd is running as PID $(cat /run/ntpd.pid)."
|
|
else
|
|
echo "ntpd is stopped."
|
|
exit 1
|
|
fi
|
|
}
|
|
|
|
case "$1" in
|
|
'start')
|
|
ntpd_start
|
|
;;
|
|
'stop')
|
|
ntpd_stop
|
|
;;
|
|
'restart')
|
|
ntpd_restart
|
|
;;
|
|
'status')
|
|
ntpd_status
|
|
;;
|
|
*)
|
|
echo "usage $0 start|stop|restart|status"
|
|
esac
|