summaryrefslogtreecommitdiffstats
path: root/utils/jenkins-jnlp-connect.sh
diff options
context:
space:
mode:
Diffstat (limited to 'utils/jenkins-jnlp-connect.sh')
-rwxr-xr-xutils/jenkins-jnlp-connect.sh15
1 files changed, 9 insertions, 6 deletions
diff --git a/utils/jenkins-jnlp-connect.sh b/utils/jenkins-jnlp-connect.sh
index 6fb6827fd..10ac50b0a 100755
--- a/utils/jenkins-jnlp-connect.sh
+++ b/utils/jenkins-jnlp-connect.sh
@@ -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
@@ -96,8 +100,8 @@ if [[ -f $monitconfdir/jenkins ]]; then
#test for diff
if [[ "$(diff $monitconfdir/jenkins <(echo "\
check process jenkins with pidfile /var/run/$jenkinsuser/jenkins_jnlp_pid
-start program = \"usr/bin/sudo -u $jenkinsuser /bin/bash -c 'cd $dir; export started_monit=true; $0 $@'\"
-stop program = \" /bin/bash -c '/bin/kill \$(/bin/cat /var/run/$jenkinsuser/jenkins_jnlp_pid)'\"\
+start program = \"/usr/bin/sudo -u $jenkinsuser /bin/bash -c 'cd $dir; export started_monit=true; $0 $@'\"
+stop program = \"/bin/bash -c '/bin/kill \$(/bin/cat /var/run/$jenkinsuser/jenkins_jnlp_pid)'\"\
") )" ]]; then
echo "Updating monit config..."
makemonit $@
@@ -123,7 +127,7 @@ then echo "pid file found"
fi
fi
-if [[ run_in_foreground == true ]]; then
+if [[ $run_in_foreground == true ]]; then
$connectionstring
else
exec $connectionstring &
@@ -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 "$@"