Bonjour,

Je suis un petit nouveau et je remercie de m'accueillir.
Je dois modifier la partie FTP du script ci-dessous pour qu'il utilise du LFTP ou FTPS, mais je ne dois pas bien faire puisque ça ne fonction pas.
Merci de bien m'apporter une aide et si possible, explications.

#!/bin/sh
#To search the error file
#If present the error file should transfer to urti server

#--------------Creating Log File----------------------------#
#Declare two different variables to create Log file
#LogS file to save all the search comands
#LogF file to save all the FTP commands
#----------------------------------------------------------------------
logs=/home/data/logscan.log
logf=/home/data/logftp.log

#_______________________________________________________________________
# If the file does not exist, create it
#_________________________________________________________________________
[ ! -f $logs ] && > $logs
[ ! -f $logf ] && > $logf


#Specify the directory to check for error file
dir=/home/data/archive_file/err_file_log
file=$dir/*.flg

echo "#############################################################" >> $logs
echo "$(date +%d-%m-%Y-%T):Search started on the server:$(uname -n) to Check Error File" >> $logs


#_______________To check error file *.flg is present____________________
#for loop to check for each value in the directory
#Cut command used to extract the file name from the path
#egrep command to check the file starting with E or A
#_______________________________________________________________________
for fn in $file
do
if [ -f $fn ]
then
#filename=$(echo $fn | cut -d'/' -f5 | egrep '[AE]')
filename=$(basename $fn | egrep '[AEI]')

#________________Loop execute if *.flg file is present___________________
#if loop is to detect file exists

if [ -f $dir/$filename ]
then
chmod 666 $dir/$filename
#_________________________________________________________________________

file_size= stat -c %s $dir/$filename >/dev/null 2>/dev/null

#_________Logging___________________________________
echo "$(date +%d-%m-%Y-%T):Name of the Error file found:$filename" >> $logs


#_________________Transferring error file to urti Server________________
#once error file is detect
#The error file should get transfer to urti server
#Get FTP credentials to enter urti Server
#_______________________________________________________________________
echo "################################################" >> $logf
echo "$(date +%d-%m-%Y-%T):FTP Process started" >> $logf
echo "$(date +%d-%m-%Y-%T):Transferring error file to the urti server" >> $logf
Host='85.45.123.141:990'
User='dauta'
Password='trasseur'
(
echo "
open $Host
user $User $Password
cd /unix_test
binary
put $fn $filename
quit
"
) | ftp -unv >> $logf 2>&1
echo "$(date +%d-%m-%Y-%T):FTP Process completed" >> $logf


#______________To check status of FTP before renaming the file____________
cat $logf | tail -5 | (grep "226 Transfer complete") >/dev/null 2>/dev/null
status=$?
if [ $status -eq 0 ]
then

#_________________________________________________________________________


#___________________Renaming and moving the transferred file____________
#Renaming and transfering the file to another directory
#filename will be changed to *.flg.transferred
#The renamed file moved to the directory /unix_script/archive_files
#_________________________________________________________________________

echo "$(date +%d-%m-%Y-%T):Renaming and Moving File Process Started" >> $logs

archive=/home/data/archive_file
if [ ! -d $archive ]
then
cd /home/hotelus
mkdir archive_file
fi

mv $fn $archive/$filename.$(date +%d-%m-%y-%T) >/dev/null 2>/dev/null

echo "$(date +%d-%m-%Y-%T):Renamed and Moved the transferred file $filename to the archive directory $archive" >> $logs
else
echo "$(date +%d-%m-%Y-%T):Error in FTP and the file is not renamed and moved to archive directory" >> $logs
echo "$(date +%d-%m-%Y-%T):Error in FTP Process the file not transferred to data server" >> $logf
fi
#_________Loop will exit without any action if E/A/I *.flg is not present__________________________
else
echo "$(date +%d-%m-%Y-%T):Search completed :Error file not found in the server $(uname -n) " >> $logs
fi

#_______________Loop will exi without any action if *.flg is not present_________________________
else
echo "$(date +%d-%m-%Y-%T):Search completed :Error file not found on the server $(uname -n)" >> $logs
fi
done