I installed activemq from archive and wished to run the broker using a specific user but I was having a problem with the "su" command lines 134 : su -c "mkdir $ACTIVEMQ_DATA" - $ACTIVEMQ_USER; and 294/295 : su -s /bin/sh -c "..." - $ACTIVEMQ_USER
Actually, the "su" command is used to "Switch User" whereas the intended task here is to execute a commad as another user. In my opinion, the "need" and the "command goal" don't match. Moreover, the "sudo" command matches better : Switch User DO. And on my platform, the "su" command doesn't support the -c parameter and only permits to change the current user before typing other commands.
So I would use the "sudo" command like that :
- line 134 : sudo -u $ACTIVEMQ_USER mkdir $ACTIVEMQ_DATA
- line 294 : DOIT_PREFIX="sudo -u $ACTIVEMQ_USER /bin/sh -c "
And I would also remove the DOIT_POSTFIX variable :
- to leave the 295th line empty
- to adjust lines 310, 323 and 333 without $DOIT_POSTFIX