~upstart-devel/upstart/upstart-jobs

« back to all changes in this revision

Viewing changes to vivid/etc/init.d/htpdate

  • Committer: Dimitri John Ledkov
  • Date: 2014-11-19 12:58:41 UTC
  • Revision ID: dimitri.j.ledkov@intel.com-20141119125841-98dr37roy8dvcv3b
auto update

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh
 
2
#
 
3
# Script for htpdate.
 
4
# C2014, Joao Eriberto Mota Filho
 
5
# Based on original upstream script, available at scripts/htpdate.init
 
6
 
 
7
### BEGIN INIT INFO
 
8
# Provides:        htpdate
 
9
# Required-Start:  $network $remote_fs $syslog
 
10
# Required-Stop:   $network $remote_fs $syslog
 
11
# Default-Start:   2 3 4 5
 
12
# Default-Stop:
 
13
# Short-Description: Start htpdate daemon
 
14
# Description:       Starts and stops the htpdate daemon used to
 
15
#                    synchronize a computer time.
 
16
### END INIT INFO
 
17
 
 
18
test -x /usr/bin/htpdate || exit 0
 
19
 
 
20
. /lib/lsb/init-functions || exit 0
 
21
 
 
22
if [ -f /etc/default/htpdate ]; then
 
23
    . /etc/default/htpdate
 
24
else
 
25
    exit 0
 
26
fi
 
27
 
 
28
if [ "$HTP_DAEMON" = "no" ]; then
 
29
    echo "htpdate is disabled. Please, see /etc/default/htpdate."
 
30
    exit 0
 
31
fi
 
32
 
 
33
HTPCOM="/usr/bin/htpdate"
 
34
PIDFILE="/var/run/htpdate.pid"
 
35
 
 
36
case "$1" in
 
37
        start)
 
38
                echo "Starting HTTP Time Protocol daemon: htpdate"
 
39
                # Set the time first before daemonizing, because the time offset
 
40
                # might be too big for smooth time adjustment
 
41
                $HTPCOM $HTP_OPTIONS $HTP_PROXY -i $PIDFILE $HTP_SERVERS
 
42
                ;;
 
43
        stop)
 
44
                echo "Stopping HTTP Time Protocol daemon: htpdate"
 
45
                if [ -f $PIDFILE ]
 
46
                then
 
47
                        kill `cat $PIDFILE`
 
48
                else
 
49
                        echo "$PIDFILE not found"
 
50
                fi
 
51
                rm -f $PIDFILE
 
52
                ;;
 
53
        restart)
 
54
                $0 stop
 
55
                $0 start
 
56
                ;;
 
57
        reload|force-reload)
 
58
                echo "Reloading htpdate"
 
59
                start-stop-daemon --stop --signal 1 --exec $HTPCOM
 
60
                ;;
 
61
        status)
 
62
                status_of_proc -p $PIDFILE $HTPCOM htpdate
 
63
                ;;
 
64
        *)
 
65
                echo "Usage: $0 {start|stop|restart|reload|force-reload|status}"
 
66
                exit 1
 
67
esac
 
68
 
 
69
exit 0