Bonjour
je dois copier une video en local sur mon linux vers un window en FTP jusque la j’ai reussis à copier un dossier de mon server window à mon server linux mais l’inverse je n’y arrive pas
Pour copier le dossier jai fais comme ca:
f | lftp
open -u 192.168.0.252/test/ MonLogin,MonMotDePass
set list-empty-ok yes
mirror /etc /etc
exit
eof
J’ai plus utilisé ftp depuis longtemps mais avec un /help ou help ou ? n’a tu pas la liste des commandes que tu peut utilisé (genre ‘put’ ou ‘puch’ et get ) ?
pour le moment j’essaye ça mais ca reste bloqué sur “>” comme i il attendait que je lui tape un mot magique.
lftp ftp://login:pass@192.168.0.252; -e “mirror -R /test2/ /home/scooplive/FTP/”; quit"
j’ai mal écrit qqchose?
#!/bin/sh
ftp -n ftp.adresse.com << EOF
user alfred
pass bidon
binary
cd lerepertoiredesvideos
put terminator17.avi
exit
EOF
[quote=“fran.b”]
#!/bin/sh
ftp -n ftp.adresse.com << EOF
user alfred
pass bidon
binary
cd lerepertoiredesvideos
put terminator17.avi
exit
EOF
[/quote]
hééé mais c’est faut…Terminator 17 est pas encore sortis ============> [- ]
Merci pour vos reponses et oui effectivement le 17 n’est pas sorti !
Entre temps j’ai trouvé cette petite ligne qui fait exactement ce que je voulais mais hélas maintenant mon probleme c’est qu’il reste bloqué sur: [connection]…
j’ai fais une vérification sur les repertoire la connection et tout est bon sauf que la connection reste bloqué:
#!/bin/sh
cat <<eof | lftp
open -u login,pass 192.169.0.252
set list-empty-ok yes
put /home/scooplive/FLV/testAVI.flv /home/scooplive/test2/testAVI.flv
exit
eof
Avez vous une idée?
tiens si cela peut t aider voila mon script que je tourne ici:
ATTENTION j utilise le Kornshell donc je ne sais pas si c est entierement compatible avec bash
#!/bin/ksh
#set -x
ping=/bin/ping
if [ `uname` = OSF1 ]
then
ping="/sbin/ping -c 1"
fi
MAIN_PATH=`pwd`
SUB_SCRIPT=NO
DOWNLOAD=NO
MAIN_SERVER=xxxxxxxxxxxxxxx
LOGIN=xxxxxxxxxxxxxxx
PASSWORD=xxxxxxxxxxxxxxx
REMOTE_PATH=/
LOGFILE=$MAIN_PATH/LOG
#-----------------------------------------------------
#
# Description: Help Procedure
#
#-----------------------------------------------------
usage()
{
cat << \EOF
transf_LOG -f <file name>
transf_LOG -n <remote node name> -d <remote directoy name> -f <remote file name>
Options:
-h : Display help.
-D : DOWNLOAD option.
-f : Remote file name
EOF
}
#-----------------------------------------------------
#
# Description: Test if the SERVER interface is alive
#
#-----------------------------------------------------
is_machine_alive()
{
#TEST if the machine is alive
SERVER=$1
access_quality=`$ping $SERVER | grep "% packet loss" | awk '{ for (i=1;i<=NF;i++) { if (substr($i,length($i))=="%") print 100-substr($i,1,length($i)-1) }}'`
if [ "$access_quality" = "" ]
then
return 1
elif [ $access_quality -eq 0 ]
then
return 1
else
return 0
fi
}
is_any_other_ftp()
{
#TEST if no other ftp session are running
SERVER=$1
ftp_session=`ps -ef | grep "ftp" | grep $SERVER `
if [ "$ftp_session" = "" ]
then
return 0
else
return 1
fi
}
#-----------------------------------------------------
#
# Description: Main procedure for the FTP transfer
#
#-----------------------------------------------------
ftp_copy_from()
{
SERVER=$1
if [ -f $ACOUNT/.netrc ]
then
rm -f $ACOUNT/.netrc
fi
# .netrc file creation - BEGIN
cat >> $ACOUNT/.netrc << EOF
machine $SERVER
login $LOGIN
password $PASSWORD
macdef init
cd $REMOTE_PATH
binary
$DOWN $FILE_TO_TRANSFERT
bye
EOF
# .netrc file creation - END
chmod 600 $ACOUNT/.netrc
cd $MAIN_PATH
# FTP copy using executing the commands in the .netrc file
ftp -i $SERVER
}
ftp_check()
{
SERVER=$1
if [ -f $ACOUNT/.netrc ]
then
rm -f $ACOUNT/.netrc
fi
# .netrc file creation - BEGIN
cat >> $ACOUNT/.netrc << EOF
machine $SERVER
login $LOGIN
password $PASSWORD
macdef init
cd $REMOTE_PATH
binary
$DOWN
bye
EOF
# .netrc file creation - END
chmod 600 $ACOUNT/.netrc
cd $MAIN_PATH
# FTP copy using executing the commands in the .netrc file
ftp -i $SERVER
}
echo_MSG()
{
MSG=$1
echo "$MSG" | /bin/tee -a $LOGFILE
}
########################################
### MAIN PROGRAM ######################
########################################
#
if [ "$ACOUNT" = "" ]
then
export ACOUNT=$HOME
fi
# Get arguments
while getopts :h:Df: arg
do
case $arg in
(h)
usage; exit;;
(D)
DOWNLOAD=YES;;
(f)
FILE_TO_TRANSFERT=$OPTARG;;
(?)
echo_MSG "Invalid argument -$OPTARG .";
usage; exit;;
esac
done
shift $(($OPTIND - 1))
#Erase previous log
if [ -f $LOGFILE ]
then
rm $LOGFILE
fi
if [ "$DOWNLOAD" = "YES" ]
then
DOWN="ls -l"
else
DOWN=mput
fi
if [ "$FILE_TO_TRANSFERT" = "" ]
then
echo "Please specify the file to transfert with option -f"
exit 1
fi
is_any_other_ftp $MAIN_SERVER
if [ $? -eq 0 ]
then
echo_MSG " OK : No FTP session at the moment"
echo_MSG ""
else
echo_MSG " ERROR : A FTP session is running now, YOU MUST WAIT"
echo_MSG ""
exit 1
fi
if [ -f $ACOUNT/.netrc ]
then
rm -f $ACOUNT/.netrc
fi
is_machine_alive $MAIN_SERVER
if [ $? -eq 0 ]
then
if [ "$DOWNLOAD" = "YES" ]
then
ftp_check $MAIN_SERVER >> $LOGFILE
FILE_TO_DOWN=`cat $LOGFILE | grep "rw\-r" | grep $FILE_TO_TRANSFERT | awk '{print $9}'`
if [ "$FILE_TO_DOWN" != "$FILE_TO_TRANSFERT" ]
then
echo_MSG " ERROR : the file to download doesnt exist of the FTP server"
echo_MSG ""
echo_MSG " Here are the existing file"
cat $LOGFILE | grep "rw-r" | awk '{print $9}'
echo_MSG ""
echo_MSG " Choose on file and press ENTER or enter N to ABORT "
echo_MSG " "
read REPONSE
if [ "$REPONSE" = "N" ] || [ "$REPONSE" = "n" ] || [ "$REPONSE" = "" ]
then
echo_MSG " EXITING ....... "
exit 1
else
FILE_TO_TRANSFERT=$REPONSE
DOWN=mget
echo_MSG " "
fi
else
echo_MSG " OK : The file to download exist"
echo_MSG ""
DOWN=mget
fi
fi
echo_MSG " OK : transfering file "
echo_MSG " : It might take a (few) minutes (if it is not hours)"
echo_MSG ""
ftp_copy_from $MAIN_SERVER >> $LOGFILE
if [ -f $ACOUNT/.netrc ]
then
rm -f $ACOUNT/.netrc
fi
else
echo_MSG " ERROR : FTP SERVER is not accessible "
echo_MSG " "
fi
et mes variables sont commentess par xxxxxxxxxxxxxxx
merci pour la réponse je vais l’étudier !