summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoragardner <agardner@linuxfoundation.org>2018-03-05 12:53:25 -0500
committeragardner <agardner@linuxfoundation.org>2018-03-05 13:06:11 -0500
commit99f9acd56d6d06ba4766542a13e468ed1b7f32dd (patch)
tree7ce6e0b72aa0b45b7a47ed7f09eb2f0758d10c29
parent7813c1d260a1bd22109f696883bbaa3c99bf1bb9 (diff)
Add start delay to monit for jnlp daemon
delay the first check by 4-minutes This is a better solution thant check process every 2 cycles check process every 2 cycles delays initial startup by 2 cycles delay check gives the script time to spawn, as the wget slave.jar takes some time from china. Change-Id: I8066e5b65efc41aaa67ee0f6ab8ee2c1aa86a67c Signed-off-by: agardner <agardner@linuxfoundation.org>
-rwxr-xr-xutils/jenkins-jnlp-connect.sh10
1 files changed, 8 insertions, 2 deletions
diff --git a/utils/jenkins-jnlp-connect.sh b/utils/jenkins-jnlp-connect.sh
index f7c67694f..c8a2b499d 100755
--- a/utils/jenkins-jnlp-connect.sh
+++ b/utils/jenkins-jnlp-connect.sh
@@ -84,8 +84,14 @@ main () {
if [ -d /etc/monit/conf.d ]; then
monitconfdir="/etc/monit/conf.d/"
+ monitconfig="/etc/monit/monitrc"
+ #add start delay
+ sed -i '/^#.* delay /s/^#//' "$monitconfig"
elif [ -d /etc/monit.d ]; then
monitconfdir="/etc/monit.d"
+ monitconfig="/etc/monitrc"
+ #add start delay
+ sed -i '/^#.* delay /s/^#//' "$monitconfig"
else
echo "Could not determine the location of the monit configuration file."
echo "Make sure monit is installed."
@@ -103,7 +109,7 @@ if does not exist then exec "$mkdir -p /var/run/$jenkinsuser"
if failed uid $jenkinsuser then exec "$chown $jenkinsuser /var/run/$jenkinsuser"
if failed gid $jenkinsuser then exec "$chown :$jenkinsuser /var/run/$jenkinsuser"
-check process jenkins with pidfile /var/run/$jenkinsuser/jenkins_jnlp_pid every 2 cycles
+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
@@ -118,7 +124,7 @@ if does not exist then exec \"$mkdir -p /var/run/$jenkinsuser\"
if failed uid $jenkinsuser then exec \"$chown $jenkinsuser /var/run/$jenkinsuser\"
if failed gid $jenkinsuser then exec \"$chown :$jenkinsuser /var/run/$jenkinsuser\"
-check process jenkins with pidfile /var/run/$jenkinsuser/jenkins_jnlp_pid every 2 cycles
+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\