2018-03-26 01:36:50 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
2019-12-14 23:24:05 +01:00
|
|
|
NTP_USER=@NTP_USER@
|
|
|
|
|
|
|
|
# place local customizations in /etc/default/chrony
|
|
|
|
[ -r /etc/default/chrony ] && . /etc/default/chrony
|
|
|
|
|
2018-03-26 01:36:50 +02:00
|
|
|
################################################################################
|
|
|
|
chronyd_start() {
|
|
|
|
################################################################################
|
|
|
|
if [ -n "$(pidof chronyd)" ]; then
|
|
|
|
echo "chronyd seems to be already running."
|
|
|
|
else
|
2019-12-14 23:24:05 +01:00
|
|
|
echo "Starting chronyd: /usr/sbin/chronyd -u $NTP_USER $CHRONYD_ARGS"
|
|
|
|
/usr/sbin/chronyd -u $NTP_USER $CHRONYD_ARGS
|
2018-03-26 01:36:50 +02:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
################################################################################
|
|
|
|
chronyd_stop() {
|
|
|
|
################################################################################
|
|
|
|
if [ -z "$(pidof chronyd)" ]; then
|
|
|
|
echo "chronyd does not seem to be running."
|
|
|
|
else
|
|
|
|
echo "Stopping chronyd..."
|
2018-12-30 01:12:12 +01:00
|
|
|
kill $(cat /var/run/chrony/chronyd.pid)
|
2018-03-26 01:36:50 +02:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
################################################################################
|
|
|
|
chronyd_restart() {
|
|
|
|
################################################################################
|
|
|
|
if [ -n "$(pidof chronyd)" ]; then
|
|
|
|
chronyd_stop
|
|
|
|
sleep 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
chronyd_start
|
|
|
|
}
|
|
|
|
|
|
|
|
case "$1" in
|
|
|
|
'start')
|
|
|
|
chronyd_start ;;
|
|
|
|
'stop')
|
|
|
|
chronyd_stop ;;
|
|
|
|
'restart')
|
|
|
|
chronyd_restart ;;
|
|
|
|
*)
|
|
|
|
echo "usage: $0 start|stop|restart" ;;
|
|
|
|
esac
|