[OpenWrt-Devel] Wait on syslog-ng

W. Michael Petullo mike at flyn.org
Fri Sep 27 07:05:19 EDT 2019

A daemon I wrote for OpenWrt depends on a running syslogd. I use
syslog-ng, and I have noticed that its init script completes before the
daemon begins to listen on /dev/log. This causes my daemon to terminate
if it starts quickly after syslog-ng.

There are a few obvious solutions:

	(1) My daemon could sleep and try again if its connection to
	syslogd fails.

	(2) My daemon's init script could sleep for one second before
	running the daemon.

	(3) Syslog-ng's init script could sleep for one second after
	executing syslog-ng and before exiting.

(3) seems the most universal, but all of these feel a little kludgy due
to the reliance on a timeout. I say this becasue you cannot precisely
predict what the timeout value should be (in practice a second or so
seems to suffice).

Does the init system provide a more general way to solve this problem?
The START=n statements seem to impose only the ordering of init script
execution and have no bearing on whether the services the scripts run
are ready. Do I have this right?

I did see sleep in a few other scripts such as network.



openwrt-devel mailing list
openwrt-devel at lists.openwrt.org

More information about the openwrt-devel mailing list