ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitProd/Processing/bin/glexec
Revision: 1.3
Committed: Wed Jul 25 03:05:45 2012 UTC (12 years, 9 months ago) by paus
Branch: MAIN
CVS Tags: Mit_029b, Mit_029, Mit_029_pre1
Changes since 1.2: +7 -8 lines
Log Message:
Preparing for new tag (Mit_029).

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.3 TICKET=$X509_USER_PROXY
6 paus 1.1 SCRIPT=$1
7    
8     if [ ".$2" != "." ]
9     then
10     #echo " Generating script: sc.$$"
11     echo "#!/bin/bash" > sc.$$
12     #echo "whoami" >> sc.$$
13     #echo "echo $*" >> sc.$$
14     echo "$*" >> sc.$$
15     SCRIPT=sc.$$
16     fi
17    
18     # Make sure it is executable
19     chmod 755 $SCRIPT
20    
21     # Copy ticket and script
22 paus 1.3 scp $TICKET $TIER2_USER@se01.cmsaf.mit.edu:$X509_USER_PROXY 2> /dev/null
23     scp $SCRIPT $TIER2_USER@se01.cmsaf.mit.edu:/tmp/ 2> /dev/null
24 paus 1.1
25     # Execute the script
26 paus 1.3 ssh $TIER2_USER@se01.cmsaf.mit.edu \
27     "export GLEXEC_CLIENT_CERT=$X509_USER_PROXY; /osg/grid/glexec-osg/sbin/glexec /tmp/$SCRIPT"
28 paus 1.1
29     # Cleanup remotely
30 paus 1.3 ssh $TIER2_USER@se01.cmsaf.mit.edu \
31     "rm /tmp/$SCRIPT $X509_USER_PROXY"
32 paus 1.1
33     # Cleanup locally
34     if [ -e sc.$$ ]
35     then
36     rm sc.$$
37     fi
38    
39     exit 0