Hi, I’m running SonarQube Developer Edition v8.3.1 on an EC2 instance running AWS Linux AMI 2 image.
I’m trying to setup SonarQube to autostart after a server reboot.
How do I do that?
I’ve tried doing the following,
$ cat /etc/init.d/sonar
#!/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 $*
$ ls -l /etc/init.d/sonar
-rwxr-xr-x 1 root root 407 Jun 10 01:28 /etc/init.d/sonar
$ ls -l /usr/bin/sonar
lrwxrwxrwx 1 root root 62 Jun 10 01:47 /usr/bin/sonar -> /home/ec2-user/sonarqube-8.3.1.34397/bin/linux-x86-64/sonar.sh
$ sudo chkconfig --list
Note: This output shows SysV services only and does not include native
systemd services. SysV configuration data might be overridden by native
systemd configuration.
If you want to list systemd services use 'systemctl list-unit-files'.
To see services enabled on particular target use
'systemctl list-dependencies [target]'.
netconsole 0:off 1:off 2:off 3:off 4:off 5:off 6:off
network 0:off 1:off 2:on 3:on 4:on 5:on 6:off
sonar 0:off 1:off 2:on 3:on 4:on 5:on 6:off
Upon reboot, I got this,
$ sudo systemctl status sonar
● sonar.service - LSB: SonarQube system (www.sonarsource.org)
Loaded: loaded (/etc/rc.d/init.d/sonar; bad; vendor preset: disabled)
Active: active (exited) since Wed 2020-06-10 02:12:15 UTC; 1min 27s ago
Docs: man:systemd-sysv-generator(8)
Process: 2448 ExecStart=/etc/rc.d/init.d/sonar start (code=exited, status=0/SUCCESS)
Jun 10 02:12:15 systemd[1]: Starting LSB: SonarQube system (www.sona.....
Jun 10 02:12:15 sonar[2448]: Starting SonarQube...
Jun 10 02:12:15 sonar[2448]: Started SonarQube.
Jun 10 02:12:15 systemd[1]: Started LSB: SonarQube system (www.sonar...).
Hint: Some lines were ellipsized, use -l to show in full.
Thanks!