Index: palm/trunk/SCRIPTS/batch_scp
===================================================================
--- palm/trunk/SCRIPTS/batch_scp	(revision 306)
+++ palm/trunk/SCRIPTS/batch_scp	(revision 693)
@@ -45,4 +45,8 @@
      # 25/10/05 - Siggi - put of catalogs realized
      # 27/04/09 - Marcus- use option -p for all scp calls
+     # 08/03/11 - Siggi - adjustments for ibmkisti: this machine allows
+     #                    outgoing ssh/scp connections only from the
+     #                    interactive nodes (gaiad). All ssh/scp traffic is
+     #                    done via this interactive node.
 
 
@@ -60,4 +64,6 @@
  get=false
  local_host=`hostname`
+ local_user=$USER
+ local_wdir=`pwd`
  locat=normal
  make_catalog=false
@@ -286,5 +292,10 @@
 
     # VERZEICHNISLSTE DES ZIELRECHNERS ERSTELLEN
- ssh $1 -l $remote_user "cd $3; ls -1; echo '*** list complete'" > $filelist  2>&1
+ if [[ $(echo $local_host | cut -c1-4) = gaia ]]
+ then
+    ssh $local_user@gaiad "ssh $1 -l $remote_user \"cd $3; ls -1; echo '*** list complete'\" "  > $filelist  2>&1
+ else
+    ssh $1 -l $remote_user "cd $3; ls -1; echo '*** list complete'" > $filelist  2>&1
+ fi
  ssh_status=$?
 
@@ -491,5 +502,10 @@
  then
     rm -rf $filelist
-    ssh $1 -l $remote_user "cd $3" > $filelist
+    if [[ $(echo $local_host | cut -c1-4) = gaia ]]
+    then
+       ssh $local_user@gaiad "ssh $1 -l $remote_user \"cd $3\" " > $filelist
+    else
+       ssh $1 -l $remote_user "cd $3" > $filelist
+    fi
     if [[ $? != 0 ]]
     then
@@ -542,4 +558,12 @@
                 scp -p -r -q -v $2 $remote_user@$1:$catalog_name$4$zyklusnr
              fi
+          elif [[ $(echo $local_host | cut -c1-4) = gaia ]]
+          then
+             if [[ $catalog_copy = false ]]
+             then
+                ssh $local_user@gaiad "cd $local_wdir; scp -p $2 $remote_user@$1:$catalog_name$4$zyklusnr"  > /dev/null
+             else
+                ssh $local_user@gaiad "cd $local_wdir; scp -p -r $2 $remote_user@$1:$catalog_name$4$zyklusnr"  > /dev/null
+             fi
           else
              if [[ $catalog_copy = false ]]
@@ -559,5 +583,10 @@
              local_size=`echo $local_size | cut -d" " -f5`
 
-             remote_size=`ssh $1 -l $remote_user "ls -al $catalog_name$4$zyklusnr"`
+             if  [[ $(echo $local_host | cut -c1-4) = gaia ]]
+             then
+                remote_size=`ssh $local_user@gaiad "ssh $1 -l $remote_user \"ls -al $catalog_name$4$zyklusnr\" "`
+             else
+                remote_size=`ssh $1 -l $remote_user "ls -al $catalog_name$4$zyklusnr"`
+             fi
              remote_size=`echo $remote_size | cut -d" " -f5`
 
@@ -571,5 +600,10 @@
           fi
        else
-          scp -p $2 $remote_user@$1:${catalog_name}batch_scp_append_file.$random  > /dev/null
+          if [[ $(echo $local_host | cut -c1-4) = gaia ]]
+          then
+             ssh $local_user@gaiad "cd $local_wdir; scp -p $2 $remote_user@$1:${catalog_name}batch_scp_append_file.$random"  > /dev/null
+          else
+             scp -p $2 $remote_user@$1:${catalog_name}batch_scp_append_file.$random  > /dev/null
+          fi
           if [[ $? != 0 ]]
           then
@@ -579,5 +613,10 @@
              local_size=`echo $local_size | cut -d" " -f5`
 
-             remote_size=`ssh $1 -l $remote_user "ls -al ${catalog_name}batch_scp_append_file.$random"`
+             if  [[ $(echo $local_host | cut -c1-4) = gaia ]]
+             then
+                remote_size=`ssh $local_user@gaiad "ssh $1 -l $remote_user \"ls -al ${catalog_name}batch_scp_append_file.$random\" "`
+             else
+                remote_size=`ssh $1 -l $remote_user "ls -al ${catalog_name}batch_scp_append_file.$random"`
+             fi
              remote_size=`echo $remote_size | cut -d" " -f5`
 
@@ -593,5 +632,10 @@
           rm  $filelist
 
-          ssh $1 -l $remote_user "cd $3; cat batch_scp_append_file.$random >> $4$zyklusnr; rm batch_scp_append_file.$random; echo '*** append complete'" > $filelist
+          if  [[ $(echo $local_host | cut -c1-4) = gaia ]]
+          then
+             ssh $local_user@gaiad "ssh $1 -l $remote_user \"cd $3; cat batch_scp_append_file.$random >> $4$zyklusnr; rm batch_scp_append_file.$random; echo '*** append complete'\" " > $filelist
+          else
+             ssh $1 -l $remote_user "cd $3; cat batch_scp_append_file.$random >> $4$zyklusnr; rm batch_scp_append_file.$random; echo '*** append complete'" > $filelist
+          fi
           if [[ $? != 0 ]]
           then
@@ -608,10 +652,20 @@
        fi
     else
-       ssh $1 -l $remote_user "mkdir -p $3"
+       if  [[ $(echo $local_host | cut -c1-4) = gaia ]]
+       then
+          ssh $local_user@gaiad "ssh $1 -l $remote_user \"mkdir -p $3\" "
+       else
+          ssh $1 -l $remote_user "mkdir -p $3"
+       fi
        if [[ $? != 0 ]]
        then
           locat=ssh_failed_4; exit
        fi
-       scp -p $2 $remote_user@$1:$catalog_name$4$zyklusnr  > /dev/null
+       if  [[ $(echo $local_host | cut -c1-4) = gaia ]]
+       then
+          ssh $local_user@gaiad "cd $local_wdir; scp -p $2 $remote_user@$1:$catalog_name$4$zyklusnr"  > /dev/null
+       else
+          scp -p $2 $remote_user@$1:$catalog_name$4$zyklusnr  > /dev/null
+       fi
        if [[ $? != 0 ]]
        then
@@ -632,5 +686,10 @@
        else
 
-          scp -p $remote_user@$1:$catalog_name$4$zyklusnr $2  > /dev/null
+          if  [[ $(echo $local_host | cut -c1-4) = gaia ]]
+          then
+             ssh $local_user@gaiad "cd $local_wdir; scp -p $remote_user@$1:$catalog_name$4$zyklusnr $2"  > /dev/null
+          else
+             scp -p $remote_user@$1:$catalog_name$4$zyklusnr $2  > /dev/null
+          fi
           if [[ $? != 0 ]]
           then
