如果声纳服务器尚未运行,我想启动它。(在我构建了我的 Maven 项目之后)。
SERVICE='sonar'
if ps ax | grep -v grep | grep $SERVICE > /dev/null
then
echo "$SERVICE service running, everything is fine"
else
echo "$SERVICE is not running"
echo "Starting $SERVICE..."
$SONAR_HOME start
fi
Jenkins 在 shell 脚本上返回以下错误。
Waiting for Jenkins to finish collecting data
channel stopped
[workspace] $ /bin/sh -xe /var/folders/nf/744vmtn93kx6c8kx1rrlnj0r0000gn/T/hudson5680063439912543848.sh
+ SERVICE=sonar
+ ps ax
+ grep -v grep
+ grep sonar
+ echo 'sonar is not running'
sonar is not running
+ echo 'Starting sonar...'
Starting sonar...
+ start
/var/folders/nf/744vmtn93kx6c8kx1rrlnj0r0000gn/T/hudson5680063439912543848.sh: line 10: start: command not found
Build step 'Execute shell' marked build as failure
Skipping sonar analysis due to bad build status FAILURE
Finished: FAILURE
任何想法为什么它失败了?
$SONAR_HOME start 从终端命令行可以正常工作。