Index: palm/trunk/SCRIPTS/batch_scp
===================================================================
--- palm/trunk/SCRIPTS/batch_scp	(revision 1091)
+++ palm/trunk/SCRIPTS/batch_scp	(revision 1094)
@@ -22,5 +22,5 @@
 # Current revisions:
 # ------------------
-# 
+# new option -P for explicit setting of ssh/scp port
 #
 # Former revisions:
@@ -104,5 +104,5 @@
 
     # SHELLSCRIPT-OPTIONEN EINLESEN
- while  getopts  :aAbcCdgmnoqsu:w:  option
+ while  getopts  :aAbcCdgmnoP:qsu:w:  option
  do
    case  $option  in
@@ -117,4 +117,5 @@
        (n)   print_local_filename=true;;  # Option ist nicht dokumentiert !
        (o)   overwrite=true;;
+       (P)   scp_port=$OPTARG;;
        (q)   quote_wait=true;;
        (s)   silent=true;;
@@ -243,4 +244,12 @@
 
 
+    # Set port number option for calls of ssh/scp, subjob and batch_scp scripts
+ if [[ "$scp_port" != "" ]]
+ then
+    PORTOPT="-P $scp_port"
+    SSH_PORTOPT="-p $scp_port"
+ fi
+
+
     # PRUEFEN, OB LOKALE DATEI/LOKALES VERZEICHNIS VORHANDEN BZW. NICHT VORHANDEN
  if [[ $get = false ]]
@@ -300,7 +309,7 @@
  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
+    ssh $SSH_PORTOPT $local_user@gaiad "ssh $SSH_PORTOPT $1 -l $remote_user \"cd $3; ls -1; echo '*** list complete'\" "  > $filelist  2>&1
  else
-    ssh -p 22 $1 -l $remote_user "cd $3; ls -1; echo '*** list complete'" > $filelist  2>&1
+    ssh $SSH_PORTOPT $1 -l $remote_user "cd $3; ls -1; echo '*** list complete'" > $filelist  2>&1
  fi
  ssh_status=$?
@@ -510,7 +519,7 @@
     if [[ $(echo $local_host | cut -c1-4) = gaia ]]
     then
-       ssh $local_user@gaiad "ssh $1 -l $remote_user \"cd $3\" " > $filelist
+       ssh $SSH_PORTOPT $local_user@gaiad "ssh $1 -l $remote_user \"cd $3\" " > $filelist
     else
-       ssh $1 -p 22 -l $remote_user "cd $3" > $filelist
+       ssh $SSH_PORTOPT $1 -l $remote_user "cd $3" > $filelist
     fi
     if [[ $? != 0 ]]
@@ -560,7 +569,7 @@
              if [[ $catalog_copy = false ]]
              then
-                scp -p -q -v $2 $remote_user@$1:$catalog_name$4$zyklusnr
+                scp $PORTOPT -p -q -v $2 $remote_user@$1:$catalog_name$4$zyklusnr
              else
-                scp -p -r -q -v $2 $remote_user@$1:$catalog_name$4$zyklusnr
+                scp $PORTOPT -p -r -q -v $2 $remote_user@$1:$catalog_name$4$zyklusnr
              fi
           elif [[ $(echo $local_host | cut -c1-4) = gaia ]]
@@ -568,14 +577,14 @@
              if [[ $catalog_copy = false ]]
              then
-                ssh $local_user@gaiad "cd $local_wdir; scp -p $2 $remote_user@$1:$catalog_name$4$zyklusnr"  > /dev/null
+                ssh $SSH_PORTOPT $local_user@gaiad "cd $local_wdir; scp $PORTOPT -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
+                ssh $SSH_PORTOPT $local_user@gaiad "cd $local_wdir; scp $PORTOPT -p -r $2 $remote_user@$1:$catalog_name$4$zyklusnr"  > /dev/null
              fi
           else
              if [[ $catalog_copy = false ]]
              then
-                scp -P 22 -p $2 $remote_user@$1:$catalog_name$4$zyklusnr  > /dev/null
+                scp $PORTOPT -p $2 $remote_user@$1:$catalog_name$4$zyklusnr  > /dev/null
              else
-                scp -P 22 -p -r $2 $remote_user@$1:$catalog_name$4$zyklusnr  > /dev/null
+                scp $PORTOPT -p -r $2 $remote_user@$1:$catalog_name$4$zyklusnr  > /dev/null
              fi
           fi
@@ -591,7 +600,7 @@
              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\" "`
+                remote_size=`ssh $SSH_PORTOPT $local_user@gaiad "ssh $SSH_PORTOPT $1 -l $remote_user \"ls -al $catalog_name$4$zyklusnr\" "`
              else
-                remote_size=`ssh $1 -p 22 -l $remote_user "ls -al $catalog_name$4$zyklusnr"`
+                remote_size=`ssh $SSH_PORTOPT $1 -l $remote_user "ls -al $catalog_name$4$zyklusnr"`
              fi
              remote_size=`echo $remote_size | cut -d" " -f5`
@@ -608,7 +617,7 @@
           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
+             ssh $SSH_PORTOPT $local_user@gaiad "cd $local_wdir; scp $PORTOPT -p $2 $remote_user@$1:${catalog_name}batch_scp_append_file.$random"  > /dev/null
           else
-             scp -P 22 -p $2 $remote_user@$1:${catalog_name}batch_scp_append_file.$random  > /dev/null
+             scp $PORTOPT -p $2 $remote_user@$1:${catalog_name}batch_scp_append_file.$random  > /dev/null
           fi
           if [[ $? != 0 ]]
@@ -621,7 +630,7 @@
              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\" "`
+                remote_size=`ssh $SSH_PORTOPT $local_user@gaiad "ssh $SSH_PORTOPT $1 -l $remote_user \"ls -al ${catalog_name}batch_scp_append_file.$random\" "`
              else
-                remote_size=`ssh $1 -p 22 -l $remote_user "ls -al ${catalog_name}batch_scp_append_file.$random"`
+                remote_size=`ssh $SSH_PORTOPT $1 -l $remote_user "ls -al ${catalog_name}batch_scp_append_file.$random"`
              fi
              remote_size=`echo $remote_size | cut -d" " -f5`
@@ -640,7 +649,7 @@
           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
+             ssh $SSH_PORTOPT $local_user@gaiad "ssh $SSH_PORTOPT $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 -p 22 -l $remote_user "cd $3; cat batch_scp_append_file.$random >> $4$zyklusnr; rm batch_scp_append_file.$random; echo '*** append complete'" > $filelist
+             ssh $SSH_PORTOPT $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 ]]
@@ -660,7 +669,7 @@
        if  [[ $(echo $local_host | cut -c1-4) = gaia ]]
        then
-          ssh $local_user@gaiad "ssh $1 -l $remote_user \"mkdir -p $3\" "
-       else
-          ssh $1 -p 22 -l $remote_user "mkdir -p $3"
+          ssh $SSH_PORTOPT $local_user@gaiad "ssh $1 -l $remote_user \"mkdir -p $3\" "
+       else
+          ssh $SSH_PORTOPT $1 -l $remote_user "mkdir -p $3"
        fi
        if [[ $? != 0 ]]
@@ -670,7 +679,7 @@
        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 22 -p $2 $remote_user@$1:$catalog_name$4$zyklusnr  > /dev/null
+          ssh $SSH_PORTOPT $local_user@gaiad "cd $local_wdir; scp $PORTOPT -p $2 $remote_user@$1:$catalog_name$4$zyklusnr"  > /dev/null
+       else
+          scp $PORTOPT -p $2 $remote_user@$1:$catalog_name$4$zyklusnr  > /dev/null
        fi
        if [[ $? != 0 ]]
@@ -694,7 +703,7 @@
           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
+             ssh $SSH_PORTOPT $local_user@gaiad "cd $local_wdir; scp $PORTOPT -p $remote_user@$1:$catalog_name$4$zyklusnr $2"  > /dev/null
           else
-             scp -P 22 -p $remote_user@$1:$catalog_name$4$zyklusnr $2  > /dev/null
+             scp $PORTOPT -p $remote_user@$1:$catalog_name$4$zyklusnr $2  > /dev/null
           fi
           if [[ $? != 0 ]]
