2014-01-16 64 views
0

我想每天晚上通過一個cronjob運行聲納亞軍:嘗試,雖然當我運行此腳本什麼也沒有發生運行從shell腳本聲納亞軍

#!/bin/bash 
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin 

cd path_to_repo 

git checkout master 
echo "on master" 
git pull 
echo "pulled" 

touch text.txt 

sonar-runner 
echo "finished scan" 

當我運行命令聲納亞軍在同一它工作正常的文件夾。

此外我還添加了一個測試命令觸摸,它也適用。只有聲納運動員不起作用。

+0

你加聲納亞軍的環境變量? –

+0

當我在命令行中運行它時,它會工作,然後環境變量被添加正確嗎? – Kim

+0

顯示任何消息? –

回答

1

太愚蠢了。在腳本中,我設定的路徑,但我將它設置不向sonarqube路徑...

的腳本是這樣的:

#!/bin/bash 
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/var/www/sonarcube/sonarrunner/bin 

cd path_to_file 

git checkout master 
echo "on master" 
git pull 
echo "pulled" 

cd ../.. 
echo "back to root folder" 

sonar-runner 
echo "finished scan"