On Fri, 15 Dec 2023, Thomas Klausner wrote:
I'm currently trying out grafana, and I noticed one weirdness after
starting it using the pkgsrc rc.d script.
# /etc/rc.d/grafana status
grafana is not running.
# cat /var/run/grafana.pid
21719# ps -auxwww | grep 21719
root 7846 0.0 0.0 12468 2212 pts/4 O+ 3:14nachm. 0:00.00
grep 21719
grafana 21719 0.0 0.1 1681352 157636 pts/4 Sl 3:08nachm. 0:02.15
grafana server -homepath /usr/pkg/share/grafana -config
/usr/pkg/etc/grafana.conf -pidfile /var/run/grafana.pid
So grafana saved its PID into /var/run/grafana.pid, which is what's
configured in the rc.d script as pidfile, but the status command
thinks it's not running, despite a grafana process with the
corresponding PID running. (I tried manually adding a newline to the
pidfile, but that doesn't change the behaviour.)
There is not even an interpreter involved, /usr/pkg/bin/grafana is a
go binary.
Does anyone have an idea what the problem could be here?
grafana rc.d script attached.
A way to check for a process-name different from the command-name seems
to be documented in /etc/rc.subr. Does this patch work?
```
--- grafana.orig 2023-12-27 08:45:46.000000000 +0000
+++ grafana 2023-12-27 08:47:37.869798624 +0000
@@ -17,6 +17,7 @@
fi
name="grafana"
+procname=$name
rcvar=$name
grafana_user="grafana"
grafana_group="grafana"
```
-RVP