2016-08-30 2 views
0

以下のリンクからsonarqubeの設定が続きます。しかし、chkconfigコマンドの実行に失敗しました。それはcentos7のサービスとしてソナークベを始めることを私をブロックしています。Sonarqube - centos 7でchkconfigをサポートしていないサービスソナー

http://docs.sonarqube.org/display/SONAR/Running+SonarQube+as+a+Service+on+Linux

http://devopscube.com/setup-and-configure-sonarqube-on-linux/

[[email protected] ~]$ cat /etc/init.d/sonar 
#! /usr/bin/sh 

/usr/bin/sonar $* 

[[email protected] ~]$ which sh 
/usr/bin/sh 

[[email protected] ~]$ ls -lrt /usr/bin/sonar 
lrwxrwxrwx. 1 root root 50 Aug 30 16:59 /usr/bin/sonar -> /usr/local/sonarqube-6.0/bin/linux-x86-64/sonar.sh 

[[email protected] init.d]$ sudo chkconfig --add sonar 
service sonar does not support chkconfig 

問題はありません手動で起動中。

[[email protected] init.d]$ sudo sonar start 
Starting SonarQube... 
Started SonarQube. 
[[email protected] init.d]$ 

答えて

1

あなた/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 $* 

私はCentOSの7.2ボックスの上にそれをテストし、それが箱から出して動作します:

wget https://sonarsource.bintray.com/Distribution/sonarqube/sonarqube-6.0.zip 
unzip sonarqube-6.0.zip 
sudo mv sonarqube-6.0 /opt 
sudo ln -s /opt/sonarqube-6.0/bin/linux-x86-64/sonar.sh /usr/bin/sonar 
sudo tee /etc/init.d/sonar <<-'EOF' 
#!/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 $* 

EOF 

sudo chmod 755 /etc/init.d/sonar 
# Enable sonar service 
sudo chkconfig --add sonar 

# Start service (systemd delegate to initd) 
sudo service sonar start 
# Stop service (systemd delegate to initd) 
sudo service sonar stop 
# Check Sonarqube log 
sudo tail -3 /opt/sonarqube-6.0/logs/sonar.log 
+0

ありがとうございます。私はそのすべてのコメントを考えた。 "/ usr/bin/sonar $ *"という行だけが追加されました。 –

関連する問題