source: hudson/master/launch_krb5_slave.sh @ 2685

Revision 2685, 1.7 KB checked in by jdsiiro, 2 years ago (diff)
  • misc updates to teh krb5 slave launcher
  • adding scripts for configuring and managing the ssh / krb5-ssh slaves
  • Property svn:executable set to *
Line 
1#!/bin/bash -l
2
3if [ $# -lt 3 ]; then
4  echo "USAGE: $0 USER HOST HUDSON_DIR [JAVA_BINDIR]"
5  exit 1
6fi
7
8# Not sure why we need to unset this, but if we don't then all ssh/scp
9# connections fail.
10unset KRB5CCNAME
11
12KINIT=/usr/bin/kinit
13SCP="/usr/bin/scp -B -o StrictHostKeyChecking=no"
14SSH="/usr/bin/ssh -x"
15
16echo "Environment:"
17env | sort | sed 's/^/   /'
18
19SLAVE_USER=$1
20SLAVE_HOST=$2
21SLAVE_HUDSON_DIR=$3
22
23echo "Attempting Hudson slave launch as $SLAVE_USER on host $SLAVE_HOST..."
24
25if [ -n "$4" ]; then
26  SLAVE_JAVA=$4/
27  echo "INFO: Using remote java in $SLAVE_JAVA"
28else
29  SLAVE_JAVA=
30fi
31
32if [ -f $HOME/$SLAVE_USER.keytab ]; then
33  KINIT_COMMAND="$KINIT -k -t $HOME/$SLAVE_USER.keytab $SLAVE_USER"
34  echo "Acquiring Kerberos tickets for user '$SLAVE_USER': "
35  echo "   $KINIT_COMMAND"
36  $KINIT_COMMAND || exit 1
37  echo "DONE"
38fi
39
40#echo -n "Verifying slave working directory: $SLAVE_USER@$SLAVE_HOSE:$SLAVE_HUDSON_DIR ... "
41#$SSH $SLAVE_USER@$SLAVE_HOST bash -c "'"mkdir -p $SLAVE_HUDSON_DIR"'"
42#echo "DONE"
43
44SSH_COMMAND="$SCP $HOME/master/war/WEB-INF/slave.jar \
45    $SLAVE_USER@$SLAVE_HOST:$SLAVE_HUDSON_DIR/."
46echo "Pushing slave jar file with command:"
47echo "   $SSH_COMMAND"
48$SSH_COMMAND || exit 1
49echo "DONE"
50
51REMOTE_COMMAND="umask 0077; cd $SLAVE_HUDSON_DIR; exec ${SLAVE_JAVA}java -jar ./slave.jar"
52
53# Ideally, we would launch our slaves with --login so that things like
54# modules are setup correctly.  Unfortunately, it appears that some
55# servers (like tlogin1) will hang indefinitely when you run a
56# non-interactive login shell.
57
58echo "Launching remote process with command:"
59echo "   $SSH $SLAVE_USER@$SLAVE_HOST '$REMOTE_COMMAND'"
60$SSH $SLAVE_USER@$SLAVE_HOST bash -c "'"$REMOTE_COMMAND"'"
Note: See TracBrowser for help on using the repository browser.