Shell rc.d daemon stop as user

Each of the commands limits(1), daemon(8), and su(1) have the purpose of modifying the environment and then executing another command within that environment. In particular, limits -C daemon applies process resource limits for su -m openhab -c 'command' which runs the 'command' using the UID of user "openhab_user" where 'command' is: sh -c "/usr/sbin/daemon -p /var/run/openhab/openhab.pid -c -t openhab /usr/local/libexec/openhab/start.sh server"

So, as you imply, the openhab daemon is being run under the UID of the user "openhab_user". To verify this assertion, examine the ownership of the PID file /var/run/openhab/openhab.pid.

An su -m ${openhab_user} in the stop function is of no use. If your UID is root, or "openhab_user", you don't need it. Otherwise, you don't have permission to stop the daemon.
 
Back
Top