summaryrefslogtreecommitdiffstats
path: root/utils
diff options
context:
space:
mode:
authorAric Gardner <agardner@linuxfoundation.org>2016-07-07 13:38:26 +0000
committerGerrit Code Review <gerrit@172.30.200.206>2016-07-07 13:38:26 +0000
commit7a15fe87e945549232a804e2984561dd772258ef (patch)
tree27fdeaabed07485e5ff0de5956667165a49dd757 /utils
parentee93f8d5acac795fa04c66df1460b21d039ad1ed (diff)
parent8db40b4d8c89857b1f89cd6604ebc273a5b1ab8d (diff)
Merge "Add check for Requiretty add timeout"
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..."