shell部分脚本如下:
#....
filelist=`find -mmin +$clean_time`
for file in $filelist
do
if [ -f $file ];then
filename=`echo $file | cut -b 3-`
curl -T $file -u $username:$password --ftp-create-dirs ftp://$remote_host_ip:$remote_host_port/$remote_dir/$filename
exec_s=$?
if [ "$exec_s" = "0" ];then
rm -f $file
cur_time=`date +%Y-%m-%d//%H:%M:%S`
echo "[$cur_time]:[$filename]...............[ok]"
elif [ "$exec_s" = "7" ];then
echo "[error]:cannot connect to host,please check remote ip address or port is correct.........[error]"
continue
elif [ "$exec_s" = "67" ];then
echo "[error]:access denied,please check username and password is correct.............[error]"
continue
elif [ "$exec_s" = "26" ];then
echo "[error]:cannot open file.............[error]"
continue
elif [ "$exec_s" = "9" ];then
echo "[error]:failed upload file,please check remote directory is correct...........[error]"
continue
else
echo "[error]:[$file] upload failed,have not know the reason.............[error]"
continue
fi
fi
done
#....
补充:好像每次都是成功上传了11个文件之后,curl命令都会报141错误,不知道为什么。。。
单独运行脚本所有文件均能成功上传。
4 个解决方案
#1
curl的错误表里面也没有141号错误啊,没看到你把错误号打印出来啊。
#2
调试的时候打印的,贴出来的是原来的脚本
在上面第8行后面添加:
echo $exec_x
打印看到输出141错误的
在上面第8行后面添加:
echo $exec_x
打印看到输出141错误的
#3
Curl returned 141 - it is result of a segfault which means it's Curls fault.
Try again and if it crashes more than a couple of times you either need to
reinstall Curl or consult with your distribution manual and contact support.
查到141错误时这么说的。。郁闷
Try again and if it crashes more than a couple of times you either need to
reinstall Curl or consult with your distribution manual and contact support.
查到141错误时这么说的。。郁闷
#4
汗,偶都是用lftp上传的,没用curl玩过ftp的路过……
#1
curl的错误表里面也没有141号错误啊,没看到你把错误号打印出来啊。
#2
调试的时候打印的,贴出来的是原来的脚本
在上面第8行后面添加:
echo $exec_x
打印看到输出141错误的
在上面第8行后面添加:
echo $exec_x
打印看到输出141错误的
#3
Curl returned 141 - it is result of a segfault which means it's Curls fault.
Try again and if it crashes more than a couple of times you either need to
reinstall Curl or consult with your distribution manual and contact support.
查到141错误时这么说的。。郁闷
Try again and if it crashes more than a couple of times you either need to
reinstall Curl or consult with your distribution manual and contact support.
查到141错误时这么说的。。郁闷
#4
汗,偶都是用lftp上传的,没用curl玩过ftp的路过……