Change the way to detect monit configuration dir 73/11073/1
authorJosep Puigdemont <josep.puigdemont@enea.com>
Wed, 9 Mar 2016 16:29:41 +0000 (17:29 +0100)
committerJosep Puigdemont <josep.puigdemont@enea.com>
Wed, 9 Mar 2016 16:43:15 +0000 (17:43 +0100)
Instead of finding out the Linux distribution of the host, try
whether one of the well known monit configuration directories exist,
and use that.

Change-Id: Ibb111661fb3a6ef8e4b4ef559b9a1d56599d59c8
Signed-off-by: Josep Puigdemont <josep.puigdemont@enea.com>
utils/jenkins-jnlp-connect.sh

index 6fb6827..e0c6ff2 100755 (executable)
@@ -48,10 +48,14 @@ if [[ $(whoami) != "root" && $(whoami) != "$jenkinsuser"  ]]; then
   exit 1
 fi
 
-if [[ $distro == Debian || $distro == Ubuntu ]]; then
+if [ -d /etc/monit/conf.d ]; then
   monitconfdir="/etc/monit/conf.d/"
-elif [[ $distro == Fedora || $distro == CentOS || $distro == Redhat ]]; then
+elif [ -d /etc/monit.d ]; then
   monitconfdir="/etc/monit.d"
+else
+  echo "Could not determine the location of the monit configuration file."
+  echo "Make sure monit is installed."
+  exit 1
 fi
 
 #make pid dir
@@ -186,6 +190,5 @@ do
 done
 
 connectionstring="java -jar slave.jar -jnlpUrl https://build.opnfv.org/ci/computer/"$slave_name"/slave-agent.jnlp -secret "$slave_secret" -noCertificateCheck "
-distro="$(tr -s ' \011' '\012' < /etc/issue | head -n 1)"
 
 main "$@"