1 vi /usr/lib/systemd/system/sonar.service
[Unit]
Description=sonar
After=network.target
[Service]
Type=forking
PIDFile=/usr/local/tomcat/tomcat.pid
ExecStart=/home/sonarqube/sonarqube-8.0/bin/linux-x86-64/sonar.sh start
ExecReload=/home/sonarqube/sonarqube-8.0/bin/linux-x86-64/sonar.sh restart
ExecStop=/home/sonarqube/sonarqube-8.0/bin/linux-x86-64/sonar.sh stop
PrivateTmp=true
[Install]
WantedBy=multi-user.target
2 chmod 755 /usr/lib/systemd/system/sonar.service
3 systemctl enable sonar