[Git][NTPsec/ntpsec][master] Fix ntpdate -s (syslog)
Matt Selsky
gitlab at mg.gitlab.com
Thu Aug 8 02:31:05 UTC 2019
Matt Selsky pushed to branch master at NTPsec / ntpsec
Commits:
59070b91 by Richard Laager at 2019-08-08T02:30:49Z
Fix ntpdate -s (syslog)
The ntpdate wrapper script was converting -s (for "log to syslog") to
ntpdig -p. This is wrong, as ntpdig -p is for the number of samples and
requires a parameter. The ntpdig man page says, "This version does not
log to syslog. Pipe standard output and standard error to logger(1) if
you want this behavior.
Signed-off-by: Richard Laager <rlaager at wiktel.com>
- - - - -
1 changed file:
- attic/ntpdate
Changes:
=====================================
attic/ntpdate
=====================================
@@ -28,7 +28,7 @@
# -p N -q How many samples to take
# -q default -q query/report only, don't set clock
# (implies -u for ntpdate)
-# -s -p log to syslog (always enabled in ntpd)
+# -s log to syslog (always enabled in ntpd)
# -t N.N -t N.N request timeout
# -u default unpriv port
# -v verbose (ntpd is always more verbose than ntpdate)
@@ -43,7 +43,8 @@
PASSTHROUGH=""
TIMEOUT="-t 1"
setclock=yes
-echo=""
+echo=no
+log=no
while getopts 46a:bBe:k:no:p:qst:uv opt
do
case $opt in
@@ -55,11 +56,11 @@ do
d) PASSTHROUGH="$PASSTHROUGH -d";;
e) echo "ntpdate: -e is no longer supported." >&2;;
k) PASSTHROUGH="$PASSTHROUGH -k $OPTARG";;
- n) echo=echo ;; # Echo generated command, don't execute
+ n) echo=yes;; # Echo generated command, don't execute
o) PASSTHROUGH="$PASSTHROUGH -o $OPTARG";;
p) echo "ntpdate: -p is no longer supported." >&2;;
q) setclock=no;;
- s) PASSTHROUGH="$PASSTHROUGH -p";;
+ s) log=yes;;
t) PASSTHROUGH="$PASSTHROUGH -t $OPTARG"; TIMEOUT="";;
u) ;;
v) ;;
@@ -72,7 +73,17 @@ then
ADJUST="-s -j"
fi
-$echo ntpdig $ADJUST $TIMEOUT $PASSTHROUGH $*
+if [ "$echo" = yes ]
+then
+ echo ntpdig $ADJUST $TIMEOUT $PASSTHROUGH $*
+else
+ if [ "$log" = yes ]
+ then
+ ntpdig $ADJUST $TIMEOUT $PASSTHROUGH $* 2>&1 | logger -t ntpdate
+ else
+ ntpdig $ADJUST $TIMEOUT $PASSTHROUGH $*
+ fi
+fi
#end
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/59070b9146de693cb36cdeab2a70be73cfb54bff
--
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/59070b9146de693cb36cdeab2a70be73cfb54bff
You're receiving this email because of your account on gitlab.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20190808/7032164f/attachment-0001.htm>
More information about the vc
mailing list