"Fossies" - the Fresh Open Source Software Archive

Member "chrony-3.5/contrib/stephan_boettcher_1" (10 May 2019, 3715 Bytes) of package /linux/misc/chrony-3.5.tar.gz:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 From stephan@nevis1.nevis.columbia.edu Mon Jun  7 20:51:57 1999
    2 Date: 04 Jun 1999 00:17:25 -0400
    3 From: Stephan I. Boettcher <stephan@nevis1.nevis.columbia.edu>
    4 To: richard@rrbcurnow.freeserve.co.uk
    5 Subject: chrony 1.1 sysV startup script for notebooks
    6 
    7 
    8 Dear Richard,
    9 
   10 I installed chrony on my notebook, running RedHat 5.1 Linux.
   11 It looks like it works.  No problems.
   12 
   13 Thank you!
   14 
   15 I like to donate my sysV startup script, appended below.
   16 
   17 Special feature:  the `online' command scans the config file to
   18 selectively turn some servers online, depending on the pcmcia SCHEME.
   19 
   20 booting:                 /etc/rc.d/init.d/chrony start
   21 /etc/ppp/ip-up:          /etc/rc.d/init.d/chrony online
   22 /etc/ppp/ip-down:        /etc/rc.d/init.d/chrony offline
   23 logrotate cron:          /etc/rc.d/init.d/chrony cyclelogs
   24 a user:                  /etc/rc.d/init.d/chrony status
   25 a sysadmin:              /etc/rc.d/init.d/chrony restart
   26 shutdown:                /etc/rc.d/init.d/chrony stop
   27 
   28 Best regards
   29 Stephan
   30 
   31 -- 
   32 
   33 ------------------------------------------------------------------------
   34 Stephan Boettcher                                   FAX: +1-914-591-4540
   35 Columbia University, Nevis Labs                     Tel: +1-914-591-2863
   36 P.O. Box 137, 136 South Broadway      mailto:stephan@nevis1.columbia.edu
   37 Irvington, NY 10533, USA          http://www.nevis.columbia.edu/~stephan
   38 ------------------------------------------------------------------------
   39 
   40 ########################### cut here ###################################
   41 #! /bin/bash
   42 #
   43 #  /etc/rc.d/init.d/chrony
   44 #
   45 #  SYS V startup script for  
   46 #  chrony ntp daemon 
   47 #  on Linux 2.0.3x notebooks with pcmcia scheme support
   48 #  $Id: stephan_boettcher_1,v 1.1 2000/04/24 21:36:04 richard Exp $
   49 #
   50 #  1999-06-02 SiB <stephan@nevis1.columbia.edu>
   51 #
   52 # For PCMCIA users:
   53 # In /etc/chrony.conf, precede the server commands for each SCHEME 
   54 # with a comment line that contains the word SCHEME and the name of
   55 # the scheme(s) that should use the servers, up to the next line that
   56 # contains the word SCHEME.  The servers must be `offline' and 
   57 # specified by their IP address.  The hostname will not do.
   58 #
   59 # Like:
   60 #
   61 #	# SCHEME nevisppp nevislan
   62 #	#       stephanpc.nevis.columbia.edu
   63 #	server  192.12.82.222   offline
   64 #
   65 #	# SCHEME desyppp desylan
   66 #
   67 #	#       dsygw2.desy.de
   68 #	server  131.169.30.15   offline
   69 #	#       dscomsa.desy.de
   70 #	server  131.169.197.35  offline
   71 
   72 CONF=/etc/chrony.conf
   73 CHRONYD=/usr/local/sbin/chronyd
   74 CHRONYC=/usr/local/bin/chronyc
   75 KEYS=/etc/chrony.keys
   76 
   77 # See if we got all we need:
   78 
   79 [ -f $CHRONYD -a -f $CHRONYC -a -r $CONF ] || exit
   80 
   81 
   82 [ -r $KEYS ]							\
   83 && CMDKEY=`awk '/^commandkey/{print $2}' $CONF`			\
   84 && PASSWORD=`awk -v KEY=$CMDKEY '$1==KEY{print $2}' $KEYS`
   85 
   86 
   87 case "$1" in
   88 
   89   start)
   90 	echo -n "Starting chronyd "
   91         $CHRONYD -r -s -f $CONF
   92         echo
   93         ;;
   94 
   95   stop)
   96         echo -n "Shutting down chronyd "
   97 	/usr/bin/killall chronyd
   98         echo
   99         ;;
  100 
  101   restart)
  102 	$0 stop
  103 	$0 start
  104 	;;
  105 
  106   on*)
  107 
  108 	[ -f /var/run/pcmcia-scheme ] && SCHEME=`cat /var/run/pcmcia-scheme`
  109 
  110 	awk  -v SCHEME=${SCHEME:-default}  -v PASSWORD=$PASSWORD  \
  111 		'
  112 		BEGIN { 
  113 			SEL=1;
  114 			print "password", PASSWORD; 
  115 		}
  116 		/SCHEME/ { 
  117 			SEL=match($0, SCHEME); 
  118 		}
  119 		SEL && /^server[ \t]*[0-9.]+[ \t].*offline/ { 
  120 			print "online 255.255.255.255/"  $2; 
  121 		}
  122 		'	\
  123 		$CONF	\
  124 	| $CHRONYC
  125 
  126 	;;
  127 
  128   off*)
  129 	cat <<-EOF | $CHRONYC
  130 		password $PASSWORD
  131 		offline
  132 		trimrtc
  133 		dump
  134 		EOF
  135 	;;
  136 
  137   *log*)
  138 	cat <<-EOF | $CHRONYC
  139 		password $PASSWORD
  140 		cyclelogs
  141 		EOF
  142 	;;
  143 
  144   stat*)
  145 	cat <<-EOF | $CHRONYC
  146 		sources
  147 		sourcestats
  148 		tracking
  149 		rtcdata
  150 		EOF
  151 	;;
  152 
  153   *)
  154         echo "Usage: chronyd {start|stop|restart|status|online|offline|cyclelogs}"
  155         exit 1
  156 	;;
  157 
  158 esac
  159 
  160 exit 0
  161 
  162