Expected behavior ----------------- ntopng service should be started AFTER the redis service (same machine). Observed behavior ----------------- ntopng starts before the redis service and therefore exits with an error: 05/Mar/2024 18:09:05 [Redis.cpp:98] ERROR: Connection error [Connection refused] 05/Mar/2024 18:09:06 [Redis.cpp:153] ERROR: ntopng requires redis server to be up and running 05/Mar/2024 18:09:06 [Redis.cpp:154] ERROR: Please start it and try again or use -r 05/Mar/2024 18:09:06 [Redis.cpp:157] ERROR: to specify a redis server other than the default /usr/local/etc/rc.d/ntopng: WARNING: failed to start ntopng rcorder shows ntopng severals service before redis: rcorder /etc/rc.d/* /usr/local/etc/rc.d/* How to reproduce ---------------- 1. Install ntopng and follow pkg-message 2. Setup local redis server 3. Enable redis and ntopng in rc.conf 4. Reboot Depending on how many other services are started, ntopng service will fail if the redis service is not up and running in time. Fix --- Change /usr/local/etc/rc.d/ntopng: < # REQUIRE: LOGIN netif mysql --- > # REQUIRE: LOGIN netif mysql redis I am aware that it is possible (and probably common) to have a redis instance on another machine and this solution would be obsolete. What do you think?
This is a difficult issue to properly fix. Blindly adding redis to REQUIRES would cause warnings in rcorder when redis is not installed on the machine (because one is using redis on another machine). This is not critical but also not optimal. Ports don't provide tools for such details. I could say that, this being a sysadmin tool, users are expected to know what they are doing and adapt the startup scripts. On the other hand, adding redis blindly would not break anything; only cause warnings, so it would be doable although unelegant. Not sure what the best choice would be, I need to think about this a little. Give me some time to check what other ports are doing and evaluate things.
Again thanks for reporting the issue. I would have not acted on this if you didn't. I now think your suggestion is correct. Adding the require when redis is not installed only causes an unharmful warning: rcorder: requirement `redis' in file `/usr/local/etc/rc.d/ntopng' has no providers. if redis happens to be installed but not enabled not even the warning is issued. So no hard in putting it there, and it would solve a real ordering issue. BTW I also forgot the script already contains a requirement on "mysql" which could also not be present or disabled. I'll commit the change shortly together with an update to the ports. Thanks again!
No, thank you Guido for your consideration and effort. I also found a mention about this conflict at the end of the rcorder manpage: The `REQUIRE' keyword is misleading: It does not describe which daemons have to be running before a script will be started. It describes which scripts must be placed before it in the dependency ordering. For exam- ple, if your script has a `REQUIRE' on `sshd', it means the script must be placed after the `sshd' script in the dependency ordering, not nec- essarily that it requires sshd to be started or enabled. Thanks again for your time and take care!
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=a08874f9512bd092dee697036af2e11c3f7dd806 commit a08874f9512bd092dee697036af2e11c3f7dd806 Author: Guido Falsi <madpilot@FreeBSD.org> AuthorDate: 2024-03-08 10:33:57 +0000 Commit: Guido Falsi <madpilot@FreeBSD.org> CommitDate: 2024-03-08 10:33:57 +0000 net/ntopng: Update to latest upstream commit, improve rc script. ntopng needs to start after redis. Add a redis REQUIRE to the rc script to make sure the correct order is applied. PR: 277507 net/ntopng/Makefile | 5 ++--- net/ntopng/distinfo | 6 +++--- net/ntopng/files/ntopng.in | 2 +- 3 files changed, 6 insertions(+), 7 deletions(-)
Requirement added to rc script.