summaryrefslogtreecommitdiffstats
path: root/utils
diff options
context:
space:
mode:
authorAric Gardner <agardner@linuxfoundation.org>2016-06-30 10:08:12 -0400
committerAric Gardner <agardner@linuxfoundation.org>2016-06-30 10:41:11 -0400
commit8db40b4d8c89857b1f89cd6604ebc273a5b1ab8d (patch)
tree1f170391b2af9f4292a0bb36c75a645de5da8a20 /utils
parentfa07c352a88830c985991b361068778239cb9cab (diff)
Add check for Requiretty add timeout
if tty is requried monit fails, this will alert the user of this issue if the wget takes to long monit panics and restart the process Change-Id: Idf40a6150d1c87ec1b4b6652ace85680c6edb4fc Signed-off-by: Aric Gardner <agardner@linuxfoundation.org>
Diffstat (limited to 'utils')
-rwxr-xr-xutils/jenkins-jnlp-connect.sh12
1 files changed, 10 insertions, 2 deletions
diff --git a/utils/jenkins-jnlp-connect.sh b/utils/jenkins-jnlp-connect.sh
index 8c41620d6..d268a28de 100755
--- a/utils/jenkins-jnlp-connect.sh
+++ b/utils/jenkins-jnlp-connect.sh
@@ -48,6 +48,14 @@ main () {
exit 1
fi
+ if [[ $(whoami) != "root" ]]; then
+ if grep "^Defaults requiretty" /etc/sudoers
+ then echo "please comment out Defaults requiretty from /etc/sudoers"
+ exit 1
+ fi
+ fi
+
+
if [ -d /etc/monit/conf.d ]; then
monitconfdir="/etc/monit/conf.d/"
elif [ -d /etc/monit.d ]; then
@@ -87,7 +95,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 $@'"
+start program = "/usr/bin/sudo -u $jenkinsuser /bin/bash -c 'cd $dir; 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
}
@@ -96,7 +104,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 $@'\"
+start program = \"/usr/bin/sudo -u $jenkinsuser /bin/bash -c 'cd $dir; 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..."