I was trying to hack multiple UPS support by duplicating /usr/local/etc/rc.d/apcupsd under several distinct names and I got into a world of hurt with the pid file, which I traced down the pidfile variable not being passed to the apcupsd executable.
I was able to fix this omission by adding one line, as below:
pidfile="/var/run/apcupsd_Fred.pid" # MODIFIED PID FILE NAME
command_args="-P $pidfile" # PROPOSED ADDITIONAL LINE
After adding this line, pid file sanity returned to my particular hackish endeavour.
This might be the totally wrong solution to my problem, but nevertheless the PID handling should work as advertised.
It can be solved with PR #180336
should be solved in ports r443914