diff options
author | Markos Chandras <mchandras@suse.de> | 2017-01-27 17:31:20 +0000 |
---|---|---|
committer | Markos Chandras <mchandras@suse.de> | 2017-01-27 17:31:20 +0000 |
commit | e731f2cdc0493f8f738de0d08414ad677af4f885 (patch) | |
tree | 2f4cc3f64715da3fec0e1b75ff2bc7fffe2314a1 /utils/jenkins-jnlp-connect.sh | |
parent | c0bab8938479ed5b30858c2583e8f0ef69b65aa8 (diff) |
utils: jenkins-jnlp-connect.sh: Drop hardcoded paths for mkdir and chown
mkdir and chown are installed in /bin on Ubuntu so determine their
path during runtime.
Change-Id: I654ad81dfe370b84b9727532e7ee0a37bfd4028f
Signed-off-by: Markos Chandras <mchandras@suse.de>
Diffstat (limited to 'utils/jenkins-jnlp-connect.sh')
-rwxr-xr-x | utils/jenkins-jnlp-connect.sh | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/utils/jenkins-jnlp-connect.sh b/utils/jenkins-jnlp-connect.sh index be9fe184d..8fce2e021 100755 --- a/utils/jenkins-jnlp-connect.sh +++ b/utils/jenkins-jnlp-connect.sh @@ -92,13 +92,16 @@ main () { exit 1 fi + chown=$(type -p chown) + mkdir=$(type -p mkdir) + 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" +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 start program = "/usr/bin/sudo -u $jenkinsuser /bin/bash -c 'cd $jenkinshome; export started_monit=true; $0 $@' with timeout 60 seconds" @@ -111,9 +114,9 @@ EOF #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\" +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 start program = \"/usr/bin/sudo -u $jenkinsuser /bin/bash -c 'cd $jenkinshome; export started_monit=true; $0 $@' with timeout 60 seconds\" |