ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitProd/Processing/bin/glexec
Revision: 1.5
Committed: Mon Jun 3 04:16:34 2013 UTC (11 years, 11 months ago) by paus
Branch: MAIN
CVS Tags: Mit_032, Mit_031, Mit_030, HEAD
Changes since 1.4: +4 -2 lines
Log Message:
Lastbeautification/fixesfor030.

File Contents

# User Rev Content
1 paus 1.2 #!/bin/bash -f
2 paus 1.1 #===================================================================================================
3     # Interface to execute a script on the server as globus ticket mapped user.
4     #===================================================================================================
5 paus 1.5 GATEWAY=se01.cmsaf.mit.edu
6     #GATEWAY=t2bat0210.cmsaf.mit.edu
7 paus 1.3 TICKET=$X509_USER_PROXY
8 paus 1.1 SCRIPT=$1
9    
10     if [ ".$2" != "." ]
11     then
12     #echo " Generating script: sc.$$"
13     echo "#!/bin/bash" > sc.$$
14     #echo "whoami" >> sc.$$
15     #echo "echo $*" >> sc.$$
16     echo "$*" >> sc.$$
17     SCRIPT=sc.$$
18     fi
19    
20     # Make sure it is executable
21     chmod 755 $SCRIPT
22    
23     # Copy ticket and script
24 paus 1.4 scp $TICKET $TIER2_USER@${GATEWAY}:$X509_USER_PROXY 2> /dev/null
25     scp $SCRIPT $TIER2_USER@${GATEWAY}:/tmp/ 2> /dev/null
26 paus 1.1
27 paus 1.5 #echo " Client certificate: $X509_USER_PROXY"
28    
29 paus 1.1 # Execute the script
30 paus 1.4 ssh $TIER2_USER@${GATEWAY} \
31     "export GLEXEC_CLIENT_CERT=$X509_USER_PROXY; /usr/sbin/glexec /tmp/$SCRIPT"
32 paus 1.1
33     # Cleanup remotely
34 paus 1.4 ssh $TIER2_USER@${GATEWAY} \
35 paus 1.3 "rm /tmp/$SCRIPT $X509_USER_PROXY"
36 paus 1.1
37     # Cleanup locally
38     if [ -e sc.$$ ]
39     then
40     rm sc.$$
41     fi
42    
43     exit 0