I want to explain how je can add an application to linux services and start/stop via services. By this example I use sonarqube as example application.
There are two steps to add an application linux services list.
1.create a script which calls your applications actual start and stop script. Save the script under /etc/init.d as execuatble file. You can use the example content als start point.
#!/bin/sh
#
# rc file
for
SonarQube
#
# chkconfig:
345
96
10
# description: SonarQube system (www.sonarsource.org)
#
### BEGIN INIT INFO
# Provides: sonar
# Required-Start: $network
# Required-Stop: $network
# Default-Start:
3
4
5
# Default-Stop:
0
1
2
6
# Short-Description: SonarQube system (www.sonarsource.org)
# Description: SonarQube system (www.sonarsource.org)
### END INIT INFO
/usr/bin/sonar $*
2-a.
Debian based linux distros such as ubuntu registers applications with "update-rc.d". We should create a symbolik link under "/user/bin" with name "sonar". /usr/bin is by default added to the PATH. So by reboot is it easy starting the application by typing only command "sonar".
sudo ln -s $SONAR_HOME/bin/linux-x86-
32
/sonar.sh /usr/bin/sonar
sudo chmod
755
/etc/init.d/sonar
sudo update-rc.d sonar defaults
2-b
Registering service on boot time for RedHat, CentOS, 64 bit based linux distro's
sudo ln -s $SONAR_HOME/bin/linux-x86-
64
/sonar.sh /usr/bin/sonar
sudo chmod
755
/etc/init.d/sonar
sudo chkconfig --add sonar