0

I want to run sonar runner every night via a cronjob though nothing happens when I run this script:

#!/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"

When I run the command sonar-runner in the same folder it works fine.

Also I added a test command touch which also works. Only sonar-runner does not work.

John M. Wright
  • 4,477
  • 1
  • 43
  • 61
Kim
  • 977
  • 1
  • 8
  • 15

1 Answers1

1

So stupid. In the script I set the path, though I set it without the path to sonarqube...

The script works like this:

#!/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"
Kim
  • 977
  • 1
  • 8
  • 15