]> git.pld-linux.org Git - packages/ntp.git/commitdiff
- run services under ntp (you may switch back to root in config)
authorElan Ruusamäe <glen@pld-linux.org>
Fri, 22 Jan 2010 19:40:54 +0000 (19:40 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
Changed files:
    ntp-client.init -> 1.9
    ntp-client.sysconfig -> 1.8
    ntp.init -> 1.26
    ntp.spec -> 1.119
    ntp.sysconfig -> 1.8

ntp-client.init
ntp-client.sysconfig
ntp.init
ntp.spec
ntp.sysconfig

index 99211d75f812be2681942d5307023667b2875142..81d3563a5a214b49e0882f5f8ec1923b881746b5 100644 (file)
@@ -11,6 +11,9 @@
 # Source networking configuration.
 . /etc/sysconfig/network
 
+# if not specified in config
+NTPDATE_USER="ntp"
+
 # Source ntp configuration
 . /etc/sysconfig/ntpdate
 
@@ -26,7 +29,7 @@ fi
 
 start() {
        show "Syncing time with ntpdate"
-       daemon /usr/sbin/ntpdate -s $NTPDATE_OPTIONS $NTPDATE_SERVERS
+       daemon /usr/sbin/ntpdate -s ${NTPDATE_USER:+-U $NTPDATE_USER} $NTPDATE_OPTIONS $NTPDATE_SERVERS
        RETVAL=$?
        if [ $RETVAL -eq 0 ]; then
                touch /var/lock/subsys/ntpdate
@@ -55,7 +58,7 @@ restart|force-reload)
        start
        ;;
 cronsettime)
-       is_yes "$NTPDATE_CRON" && /usr/sbin/ntpdate -s $NTPDATE_OPTIONS $NTPDATE_SERVERS > /dev/null 2>&1
+       is_yes "$NTPDATE_CRON" && /usr/sbin/ntpdate -s ${NTPDATE_USER:+-U $NTPDATE_USER} $NTPDATE_OPTIONS $NTPDATE_SERVERS > /dev/null 2>&1
        RETVAL=$?
        ;;
 *)
index 0bc6ec6396b1c0a445636dc244928553637b8acd..6c8037c212920353016fc99dd384a9c7d80ab621 100644 (file)
@@ -1,10 +1,13 @@
 # Sync time at startup
-NTPDATE_OPTIONS="-o 1 -u -U ntp"
+NTPDATE_OPTIONS="-o 1 -u"
 
 #NTPDATE_SERVERS="ntp.nasa.gov clock.isc.org"
 #NTPDATE_SERVERS="ntp.certum.pl vega.cbk.poznan.pl"
 NTPDATE_SERVERS="pool.ntp.org"
 
+# switch user to this user when running ntpdate(1)
+NTPDATE_USER="ntp"
+
 # Set to 'yes' to sync hw clock after successful ntpdate
 SYNC_HWCLOCK="no"
 
index efbe9c57d4e66aedcdab03e35b0d5d0db29beb4d..b64a7fb1b1a1337456a25254e2b72d65f64125f8 100644 (file)
--- a/ntp.init
+++ b/ntp.init
 # Source networking configuration.
 . /etc/sysconfig/network
 
+# default user if not overriden by config
+NTPD_USER="ntp"
+
 # Source ntp configuration
 . /etc/sysconfig/ntpd
 
 # Check that networking is up.
 if is_yes "${NETWORKING}"; then
        if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
-               msg_network_down ntpd
+               msg_network_down "ntpd"
                exit 1
        fi
 else
@@ -30,22 +33,22 @@ fi
 start() {
        # Check if the service is already running?
        if [ ! -f /var/lock/subsys/ntpd ]; then
-               msg_starting ntpd
-               daemon /usr/sbin/ntpd -c /etc/ntp/ntp.conf -p /var/run/ntpd.pid $NTPD_OPTIONS
+               msg_starting "ntpd"
+               daemon /usr/sbin/ntpd -c /etc/ntp/ntp.conf -p /var/run/ntpd.pid ${NTPD_USER:+-u $NTPD_USER} $NTPD_OPTIONS
                RETVAL=$?
                [ $RETVAL -eq 0 ] && touch /var/lock/subsys/ntpd
        else
-               msg_already_running ntp
+               msg_already_running "ntpd"
        fi
 }
 
 stop() {
        if [ -f /var/lock/subsys/ntpd ]; then
-               msg_stopping ntpd
+               msg_stopping "ntpd"
                killproc ntpd
                rm -f /var/lock/subsys/ntpd
        else
-               msg_not_running ntpd
+               msg_not_running "ntpd"
        fi
 }
 
@@ -54,7 +57,7 @@ condrestart() {
                stop
                start
        else
-               msg_not_running ntpd
+               msg_not_running "ntpd"
                RETVAL=$1
        fi
 }
index 188ac5d3864734694f122fbb7d606b28afa5060c..b4d0f34600c4bea2ea9d03e02e56f2c887a5e84e 100644 (file)
--- a/ntp.spec
+++ b/ntp.spec
@@ -1,5 +1,4 @@
 # TODO
-# - see if ntpd can be droproot too as ntpdate is patched
 # - ntpd default config is too restrictive (ntpq -p should work locally)
 %include       /usr/lib/rpm/macros.perl
 Summary:       Network Time Protocol utilities
@@ -7,7 +6,7 @@ Summary(pl.UTF-8):      Narzędzia do synchronizacji czasu (Network Time Protocol)
 Summary(pt_BR.UTF-8):  Network Time Protocol versão 4
 Name:          ntp
 Version:       4.2.4p8
-Release:       3.3
+Release:       3.4
 License:       distributable
 Group:         Daemons
 Source0:       http://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/ntp-4.2/%{name}-%{version}.tar.gz
index a81a88bd8776aafa973ee4f9d7c7f893bdb6f851..6688f86525a367b96e7fc8410f61aaa6e7105b0f 100644 (file)
@@ -3,7 +3,9 @@
 # Define services nice level
 SERVICE_RUN_NICE_LEVEL="+1"
 
-
 # pass additional arguments (like -g)
-#NTPD_OPTIONS="-l /var/log/ntpd.log"   # this demands logrotate to avid problems
+#NTPD_OPTIONS="-l /var/log/ntpd.log" # this demands logrotate to avoid problems
 NTPD_OPTIONS=""
+
+# switch user to this user when running ntpd(1)
+NTPD_USER="ntp"
This page took 0.042824 seconds and 4 git commands to generate.