ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/CRAB/python/rcondor.sh
Revision: 1.1
Committed: Tue Aug 7 21:44:42 2012 UTC (12 years, 8 months ago) by belforte
Content type: application/x-sh
Branch: MAIN
CVS Tags: CRAB_2_9_1, CRAB_2_9_1_pre2, CRAB_2_9_1_pre1, CRAB_2_9_0, CRAB_2_9_0_pre2, CRAB_2_9_0_pre1, CRAB_2_8_8, CRAB_2_8_8_pre1, CRAB_2_8_7_patch3, CRAB_2_8_7_patch2, CRAB_2_8_7_patch1, CRAB_2_8_7, CRAB_2_8_7_pre2, CRAB_2_8_7_pre1, CRAB_2_8_6, CRAB_2_8_6_pre1, CRAB_2_8_5_patch3, CRAB_2_8_5_patch2, CRAB_2_8_5_patch1, CRAB_2_8_5, CRAB_2_8_5_pre5, CRAB_2_8_5_pre4, CRAB_2_8_5_pre3, CRAB_2_8_4_patch3, CRAB_2_8_5_pre2, CRAB_2_8_4_patch2, CRAB_2_8_5_pre1, CRAB_2_8_4_patch1, CRAB_2_8_4, CRAB_2_8_4_pre5, CRAB_2_8_4_pre4, CRAB_2_8_4_pre3, CRAB_2_8_4_pre2, CRAB_2_8_4_pre1, CRAB_2_8_3, CRAB_2_8_3_pre4, CRAB_2_8_3_pre3, CRAB_2_8_3_pre2, CRAB_2_8_3_pre1, CRAB_2_8_2_patch1, CRAB_2_8_2, HEAD
Log Message:
adapted from rcondor distribution

File Contents

# User Rev Content
1 belforte 1.1 #!/bin/bash
2     cmd=`basename "$0"`
3    
4     if [ -z $RCONDOR_HOST ]; then
5     echo "rcondor: \$RCONDOR_HOST not defined" >&2
6     exit 1
7     fi
8    
9     conf=${HOME}/.rcondor/${RCONDOR_HOST}/rcondor.conf
10    
11     if [ ! -f $conf ]; then
12     echo "rcondor: config file does not exist: $conf" >&2
13     exit 1
14     fi
15    
16     # parse config file
17     usr_host=`awk -F = '/^ *USR_HOST *=/ {print $2}' "$conf"`
18     usr_host=`echo $usr_host` # strip whitespaces
19     local=`awk -F = '/^ *LOCAL *=/ {print $2}' "$conf"`
20     local=`echo $local`
21     remote=`awk -F = '/^ *REMOTE *=/ {print $2}' "$conf"`
22     remote=`echo $remote`
23    
24     # make sure config values are nonzero length
25     if [ -z "$usr_host" ] || [ -z "$local" ] || [ -z "$remote" ]; then
26     echo "rcondor: error parsing $conf" >&2
27     exit 1
28     fi
29    
30     if ! pwd | grep -q "^${local}"; then
31     echo "rcondor: working directory outside of mount point: $local" >&2
32     exit 1
33     fi
34    
35     wdir=`pwd | sed "s|${local}|${remote}|g"`
36    
37     # wrap each argument in quotes to preserve whitespaces
38     for arg in "$@"; do
39     args=$args"'$arg' "
40     done
41    
42     gsissh $usr_host "cd '$wdir' && $cmd $args"