Skip to main content
Topic solved
This topic has been marked as solved and requires no further attention.
Topic: ntpd redirection to /dev/null (Read 1067 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

ntpd redirection to /dev/null

The ntpd run script has this:
Code: [Select]
exec ntpd -g -u ntp:ntp -n >/dev/null
. Unfortunately, that's not a redirection - the >/dev/null part is taken as an explicit argument to ntpd, resulting in:

Quote
Dec 14 11:47:01 [daemon|err] ntpd[1111]: giving up resolving host >/dev/null: Name or service not known (-2)

To redirect an fd to a file you need to use redirfd:
Code: [Select]
#!/usr/bin/execlineb -P

fdmove -c 2 1
redirfd -w 2 /dev/null
exec ntpd -g -u ntp:ntp -n
Seems to work.

Re: ntpd redirection to /dev/null

Reply #1
Not sure if you also need to redirect fd=1 after the fdmove.

Re: ntpd redirection to /dev/null

Reply #2
Yikes, a quick recursive grep on my directory shows quite a few of shell-style redirects in places they don't belong. Clearly, they don't work in execline. Thanks for pointing them out. I'll fix these ASAP.

Actually I don't think you need fdmove here at all. Only stdout should be directed to null so just this should do it.
Code: [Select]
redirfd -w 1 /dev/null
exec ntpd -g -u ntp:ntp -n

Seems to work. Presumably if it raises an error of some sort, it should still print out.

Re: ntpd redirection to /dev/null

Reply #3
Alright this should be fixed now along with any other scripts that had this problem. ntp-s6 is an extra package so I pushed the new one directly to the extra repo so you should be able to catch it immediately on the next mirror sync. A handful of scripts in the system repo were in here so those will sit in testing for a bit before I move them into system.

Sidenote: Thanks for all your help catching these issues so far. s6 is extremely underrated in my opinion. The last thing I want is people to get a bad first impression because I screwed up a script somewhere. :P

Re: ntpd redirection to /dev/null

Reply #4
I only run a handful services and ntp was the only one with this problem. Just got the update and appears to be working as intended!

Sidenote: Thanks for all your help catching these issues so far. s6 is extremely underrated in my opinion. The last thing I want is people to get a bad first impression because I screwed up a script somewhere. :P
Glad I can help. There's something about s6 that just feels... right.