]> git.pld-linux.org Git - packages/rdate.git/blob - rdate.init
- first try to make use with status of this script...
[packages/rdate.git] / rdate.init
1 #!/bin/sh
2 #
3 # rdate         This shell script takes care of setting date from ntp server on startup
4 #
5 # chkconfig:    2345 11 89
6 # description:  set time with rdate
7 # processname:  rdate
8
9 # Source function library.
10 . /etc/rc.d/init.d/functions
11
12 # Source networking configuration.
13 . /etc/sysconfig/network
14
15 # Check that networking is up.
16 if is_no "${NETWORKING}"; then
17         msg_network_down rdate
18         exit 1
19 fi
20
21 SET_TIME=no
22
23 # Get service config
24 if [ -f /etc/sysconfig/rdate ] ; then
25         . /etc/sysconfig/rdate
26 fi
27
28 # See how we were called.
29 case "$1" in
30   start|restart)
31         # Check if we have to do anything:
32         if [ "$SET_TIME" = "yes" ]; then
33                 if [ -n "$RDATE_SERVER" ]; then
34                         run_cmd "Setting time from remote server: $RDATE_SERVER" rdate -s -l $RDATE_SERVER
35                 fi
36         fi
37         ;;
38   stop)
39         # nothing to do
40         ;;
41   status)
42         if [ -n "$RDATE_SERVER" ]; then
43                 rdate $RDATE_SERVER
44                 echo -n "Local time: "
45                 date
46                 echo -n "Local machine hardware clock: "
47                 clock --show
48         fi
49         ;;
50   *)
51         msg_usage "$0 {start|stop|restart|status}"
52         exit 1
53 esac
This page took 0.025797 seconds and 3 git commands to generate.