FTP客户端Shell脚本,实现指定目录下逐个上传文件
2021-08-06 20:56
标签:led bash 上传 pre use name style nbsp loaded 脚本内容: #!/bin/bash function findProc() { PROC_NAME=ftp ProcNumber=`ps -ef |grep -w $PROC_NAME|grep -v grep|wc -l` if [ $ProcNumber -le 0 ];then fileftp exit else sleep 120 findProc fi } function fileftp() { USER=uploadfile PASS=uploadfile HOST=192.168.10.69 PORT=21 uploadDir=/home/uploadfile/ for upfile in `ls $uploadDir` do exec 6>&1 1>/tmp/ftptmp.txt ftp -nv! exec 1>&6 exec 6>&- if grep -q "Transfer complete" /tmp/ftptmp.txt;then echo -n "`date ‘+%Y-%m-%d %H:%M‘` ---> " >> /home/uploadfile/upload_ftp.log echo "$upfile has been successfully uploaded." >> /home/uploadfile/upload_ftp.log if [ $upfile != "upload_ftp.log" ];then rm -f $uploadDir/$upfile fi else echo -n "`date ‘+%Y-%m-%d %H:%M‘` ---> " >> /home/uploadfile/upload_ftp.log echo "$upfile uploaded failed." >> /home/uploadfile/upload_ftp.log fi done } findProc FTP客户端Shell脚本,实现指定目录下逐个上传文件标签:led bash 上传 pre use name style nbsp loaded 原文地址:https://www.cnblogs.com/caoyibin/p/14883265.html
文章标题:FTP客户端Shell脚本,实现指定目录下逐个上传文件
文章链接:http://soscw.com/essay/107286.html