summaryrefslogblamecommitdiffstats
path: root/network/chrony/rc.chrony
blob: fc74d34ae251392f7afd3829db0317fb037dada6 (plain) (tree)
1
2
3
4
5
6
7
8
9
10







                                                                                

                                                             









                                                                                
                                           























                                                                                
#!/bin/sh

################################################################################
chronyd_start() {
################################################################################
  if [ -n "$(pidof chronyd)" ]; then
    echo "chronyd seems to be already running."
  else
    echo "Starting chronyd:  /usr/sbin/chronyd -u @NTP_USER@"
    /usr/sbin/chronyd -u @NTP_USER@
  fi
}

################################################################################
chronyd_stop() {
################################################################################
  if [ -z "$(pidof chronyd)" ]; then
    echo "chronyd does not seem to be running."
  else
    echo "Stopping chronyd..."
    kill $(cat /var/run/chrony/chronyd.pid)
  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