The difference is the position of the command. But the main issue with your script is this block of code:
# Avoid root execution
if [ `id|sed -e s/uid=//g -e s/\(.*//g` -eq 0 ] && [ "$2" != "stop" ]; then
echo "Execution by root not allowed"
Why did you add it? This file will be run as root (as all the files in the
init.d directory), and will exit because you are not allowing it to be run as root. Note that we are running the file
/home/sankofa/lampstack-7.3.8-0/ctlscript.sh as user
sankofa, so despite the
bitnami-lampstack script being run as root, the actual application won't be run as root.
Use this, as the documentation states, and it should work:
### BEGIN INIT INFO
# Provides: bitnami-lampstack
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start daemon at boot time
# Description: Enable services provided by daemon.
### END INIT INFO
su sankofa -c "/home/sankofa/lampstack-7.3.8-0/ctlscript.sh $@"