summaryrefslogtreecommitdiff
path: root/network/openntpd/rc.ntpd
blob: 249df02de80bfe7bf257270e83245afcd1465a95 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/bin/sh
# Start/stop/restart the network time protocol daemon 
#
# Written for Slackware Linux by Robby Workman <http://rlworkman.net> 
# ##  (by modifying one of Pat's scripts)
# Add -s to the command to set the time at startup

ntpd_start() {
  if [ -x /usr/sbin/ntpd ]; then
    echo "Starting ntpd daemon: /usr/sbin/ntpd "
    /usr/sbin/ntpd 2> /dev/null
    sleep 1 
  fi
}

ntpd_stop() {
  echo "Stopping ntpd daemon..."
  killall ntpd 2> /dev/null
}

ntpd_restart() {
  ntpd_stop
  sleep 1
  ntpd_start
}

case "$1" in
'start')
 ntpd_start
  ;;
'stop')
  ntpd_stop
  ;;
'restart')
 ntpd_restart
  ;;
*)
  echo "usage $0 start|stop|restart"
esac