First Commit - Source Code from Reply
This commit is contained in:
63
dbcmnpsrc/FE/mnpapp/script/ftp_GSTM
Normal file
63
dbcmnpsrc/FE/mnpapp/script/ftp_GSTM
Normal file
@@ -0,0 +1,63 @@
|
||||
#!/bin/ksh
|
||||
#set -x
|
||||
# Progetto: Gateway MNP
|
||||
# Script: ftp_GSTM
|
||||
# Descrizione: FTP dei file verso GSTM
|
||||
# $1 $2 $3 $4
|
||||
# Parametri: nome_file host user password
|
||||
|
||||
# impostazione ambiente
|
||||
THIS_PATH=`dirname $0`
|
||||
. $THIS_PATH/setEnv.sh
|
||||
|
||||
adesso=$(date)
|
||||
|
||||
THIS=`basename $0`
|
||||
LOG=$MNP_LOG_SCRIPT_HOME/$THIS.log
|
||||
|
||||
echo '*****' $adesso Eseguo ftp verso GSTM >> $LOG
|
||||
|
||||
# Elimina il percorso dal nome del file per ottenere il nome file remoto
|
||||
|
||||
remote=$(echo $1 | awk -F/ '{print $NF}')
|
||||
|
||||
# KIT200507
|
||||
# inserisco un carattere nel CTR per evitare problemi di ftp di file con size = 0
|
||||
[ -s $1 ] || (echo " ") >> $1
|
||||
# KIT200507
|
||||
|
||||
# Esegui l'FTP
|
||||
|
||||
ftp -n > outFtp 2> errFtp <<PARAM
|
||||
open $2
|
||||
user $3 $4
|
||||
quote site lrecl=40
|
||||
put $1 '$remote'
|
||||
bye
|
||||
PARAM
|
||||
|
||||
|
||||
# Controlla l'output del comando ftp per determinare se ci sono stati
|
||||
# problemi
|
||||
|
||||
if [[ -s errFtp || -s outFtp ]]
|
||||
then
|
||||
echo Trasferimento errato per il file $1 >> $LOG
|
||||
|
||||
if [[ -s outFtp ]]
|
||||
then
|
||||
echo '---- outFtp: ' >> $LOG
|
||||
cat outFtp >> $LOG
|
||||
fi
|
||||
|
||||
if [[ -s errFtp ]]
|
||||
then
|
||||
echo '---- errFtp: ' >> $LOG
|
||||
cat errFtp >> $LOG
|
||||
fi
|
||||
|
||||
exit 1
|
||||
else
|
||||
echo File $1 trasferito con successo >> $LOG
|
||||
exit 0
|
||||
fi
|
||||
Reference in New Issue
Block a user