Parcourir la source

I implemented a "no daemon mode" a improve system security. Therefore a new variable has been introduced called "ntp_daemon". Assume that we have following set in rc.conf ntp_enable="yes" <-- default ntp_daemon="no" no permanent daemon process will be started. Instead time sync is done every hour using ntpdate. Furthermore the sync is delayed for 30 seconds since we don't want to mess up any cron jobs which might be running every clear minute.

Christoph Schug il y a 24 ans
Parent
commit
a750ec6682
2 fichiers modifiés avec 17 ajouts et 4 suppressions
  1. 1 1
      ntp/ntp.spec
  2. 16 3
      ntp/rc.ntp

+ 1 - 1
ntp/ntp.spec

@@ -33,7 +33,7 @@ Distribution: OpenPKG [REL]
 Group:        Net
 License:      BSD-style
 Version:      4.1.0
-Release:      20020206
+Release:      20020226
 
 #   list of sources
 Source0:      http://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/ntp-%{version}.tar.gz

+ 16 - 3
ntp/rc.ntp

@@ -5,6 +5,7 @@
 
 %config
     ntp_enable="yes"
+    ntp_daemon="yes"
     ntp_log_prolog="true"
     ntp_log_epilog="true"
     ntp_log_numfiles="10"
@@ -25,6 +26,7 @@
     @l_prefix@/bin/ntpdate \
         `grep "^server" @l_prefix@/etc/ntp/ntp.conf |\
          awk '{ printf(" %s", $2); }'`
+    opVarIsYes ntp_daemon || exit 0
     #   run the NTP daemon for continued synchronization
     @l_prefix@/bin/ntpd \
         -p @l_prefix@/var/ntp/ntpd.pid \
@@ -33,11 +35,11 @@
         -s @l_prefix@/var/ntp/ntpd.stat/
 
 %stop -p 200 -u root
-    opServiceEnabled ntp || exit 0
+    opServiceEnabled ntp && opVarIsYes ntp_daemon || exit 0
     ntp_signal TERM
 
 %restart -u root
-    opServiceEnabled ntp || exit 0
+    opServiceEnabled ntp && opVarIsYes ntp_daemon || exit 0
     ntp_signal TERM
     sleep 2
     #   restart the NTP daemon for continued synchronization
@@ -47,8 +49,19 @@
         -l @l_prefix@/var/ntp/ntpd.log \
         -s @l_prefix@/var/ntp/ntpd.stat/
 
-%daily -u root
+%hourly -u root
     opServiceEnabled ntp || exit 0
+    opVarIsYes ntp_daemon && exit 0
+    (
+        sleep 30
+        @l_prefix@/bin/ntpdate \
+            `grep "^server" @l_prefix@/etc/ntp/ntp.conf |\
+             awk '{ printf(" %s", $2); }'`
+    ) >/dev/null &
+        
+
+%daily -u root
+    opServiceEnabled ntp && opVarIsYes ntp_daemon || exit 0
     opTmpDirGen ntp
     opTmpDirFile ntp hint hintfile
     prolog="true"