From 90dbe41e705c6247f0171380f49873ac40a54eb1 Mon Sep 17 00:00:00 2001 From: Markos Chandras Date: Thu, 24 Nov 2016 13:32:57 +0000 Subject: [PATCH] utils: jenkins-jnlp-connect.sh: Fix start up script The jenkins-jnlp-connect.sh script is meant to be executed from the $jenkinshome directory. The monit script was configured to enter a different directory before starting the jenkins script which always resulted in a broken start-up phase like this: "This script needs to be run from the jenkins users home dir" We fix this by entering the $jenkinshome directory before starting up the jenkins script. Change-Id: If0f65417f07a7fa9328f9adcd1ca1a1a3bc530ed Signed-off-by: Markos Chandras --- utils/jenkins-jnlp-connect.sh | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/utils/jenkins-jnlp-connect.sh b/utils/jenkins-jnlp-connect.sh index 9ef4298ef..33463e153 100755 --- a/utils/jenkins-jnlp-connect.sh +++ b/utils/jenkins-jnlp-connect.sh @@ -30,8 +30,6 @@ EOF } main () { - dir=$(cd $(dirname $0); pwd) - #tests if [[ -z $jenkinsuser || -z $jenkinshome ]]; then echo "jenkinsuser or home not defined, please edit this file to define it" @@ -100,7 +98,7 @@ main () { echo "Writing the following as monit config:" cat << EOF | tee $monitconfdir/jenkins 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 $@' with timeout 60 seconds" +start program = "/usr/bin/sudo -u $jenkinsuser /bin/bash -c 'cd $jenkinshome; export started_monit=true; $0 $@' with timeout 60 seconds" stop program = "/bin/bash -c '/bin/kill \$(/bin/cat /var/run/$jenkinsuser/jenkins_jnlp_pid)'" EOF } @@ -109,7 +107,7 @@ EOF #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 $@' with timeout 60 seconds\" +start program = \"/usr/bin/sudo -u $jenkinsuser /bin/bash -c 'cd $jenkinshome; export started_monit=true; $0 $@' with timeout 60 seconds\" stop program = \"/bin/bash -c '/bin/kill \$(/bin/cat /var/run/$jenkinsuser/jenkins_jnlp_pid)'\"\ ") )" ]]; then echo "Updating monit config..." -- 2.16.6