summaryrefslogtreecommitdiffstats
path: root/utils
diff options
context:
space:
mode:
authorFatih Degirmenci <fatih.degirmenci@ericsson.com>2017-01-11 18:49:47 +0000
committerGerrit Code Review <gerrit@opnfv.org>2017-01-11 18:49:47 +0000
commit66748e90b09e7398e675285c10fc286b5c740f26 (patch)
tree06f4ada6da379ce12b67c25a1b9ee7b25d3921c5 /utils
parent833deb5c594672dcaf1151ecf32ae13456e94571 (diff)
parent309d7e37065bea52e31f0cb6573dc8d19a41fc0b (diff)
Merge "utils/jenkins-jnlp-connect.sh: Make sure the pid directory exists"
Diffstat (limited to 'utils')
-rwxr-xr-xutils/jenkins-jnlp-connect.sh14
1 files changed, 13 insertions, 1 deletions
diff --git a/utils/jenkins-jnlp-connect.sh b/utils/jenkins-jnlp-connect.sh
index 9751a90de..be9fe184d 100755
--- a/utils/jenkins-jnlp-connect.sh
+++ b/utils/jenkins-jnlp-connect.sh
@@ -95,18 +95,30 @@ main () {
makemonit () {
echo "Writing the following as monit config:"
cat << EOF | tee $monitconfdir/jenkins
+check directory jenkins_piddir path /var/run/$jenkinsuser
+if does not exist then exec "/usr/bin/mkdir -p /var/run/$jenkinsuser"
+if failed uid $jenkinsuser then exec "/usr/bin/chown $jenkinsuser /var/run/$jenkinsuser"
+if failed gid $jenkinsuser then exec "/usr/bin/chown :$jenkinsuser /var/run/$jenkinsuser"
+
check process jenkins with pidfile /var/run/$jenkinsuser/jenkins_jnlp_pid
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)'"
+depends on jenkins_piddir
EOF
}
if [[ -f $monitconfdir/jenkins ]]; then
#test for diff
if [[ "$(diff $monitconfdir/jenkins <(echo "\
+check directory jenkins_piddir path /var/run/$jenkinsuser
+if does not exist then exec \"/usr/bin/mkdir -p /var/run/$jenkinsuser\"
+if failed uid $jenkinsuser then exec \"/usr/bin/chown $jenkinsuser /var/run/$jenkinsuser\"
+if failed gid $jenkinsuser then exec \"/usr/bin/chown :$jenkinsuser /var/run/$jenkinsuser\"
+
check process jenkins with pidfile /var/run/$jenkinsuser/jenkins_jnlp_pid
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)'\"\
+stop program = \"/bin/bash -c '/bin/kill \$(/bin/cat /var/run/$jenkinsuser/jenkins_jnlp_pid)'\"
+depends on jenkins_piddir\
") )" ]]; then
echo "Updating monit config..."
makemonit $@