X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=utils%2Fjenkins-jnlp-connect.sh;h=9ef4298efeca34ef6f49bbe9bb0b44a7fe372fd3;hb=7891b74307d0c69acf5d7a77e8393dc46b3f903b;hp=d268a28de4f412d5a9bb6288e060e3ca64fb55c4;hpb=7a15fe87e945549232a804e2984561dd772258ef;p=releng.git diff --git a/utils/jenkins-jnlp-connect.sh b/utils/jenkins-jnlp-connect.sh index d268a28de..9ef4298ef 100755 --- a/utils/jenkins-jnlp-connect.sh +++ b/utils/jenkins-jnlp-connect.sh @@ -38,6 +38,11 @@ main () { exit 1 fi + if [[ $(pwd) != "$jenkinshome" ]]; then + echo "This script needs to be run from the jenkins users home dir" + exit 1 + fi + if [[ -z $slave_name || -z $slave_secret ]]; then echo "slave name or secret not defined, please edit this file to define it" exit 1 @@ -49,8 +54,8 @@ main () { fi if [[ $(whoami) != "root" ]]; then - if grep "^Defaults requiretty" /etc/sudoers - then echo "please comment out Defaults requiretty from /etc/sudoers" + if sudo -l | grep "requiretty"; then + echo "please comment out Defaults requiretty from /etc/sudoers" exit 1 fi fi @@ -146,6 +151,7 @@ fi usage() { cat << EOF +**this file must be copied to the jenkins home directory to work** jenkins-jnlp-connect.sh configures monit to keep slave connection up Checks for new versions of slave.jar run as root to create pid directory and create monit config.