大佬们能不能帮我看看呢我是稍微改了下萌咖大佬的脚本,但是并没有成功上传,aria2的日志里可以看到确实执行了脚本
#!/bin/bash
GID="$1";
FileNum="$2";
File="$3";
MinSize="2" #限制最低上传大小,默认2k
MaxSize="1572864000" #限制最高文件大小(单位k),默认150G
RemoteDIR="/LixianDir/";
DiskFlag="A"
LocalDIR="/data/wwwroot/download/"; #Aria2下载目录,最后面保留/
if [[ "$FileNum" -eq ‘1’ ]]; then
Option=" Upload";
else
Option=" UploadDir";
fi
#if [[ -z $(echo "$FileNum" |grep -o ‘[0-9]*’ |head -n1) ]]; then FileNum=’0′; fi
#if [[ "$FileNum" -le ‘0’ ]]; then exit 0; fi
#if [[ "$#" != ‘3’ ]]; then exit 0; fi
function LoadFile(){
IFS_BAK=$IFS
IFS=$’\n’
if [[ ! -d "$LocalDIR" ]]; then return; fi
if [[ -e "$File" ]]; then
FileLoad="${File/#$LocalDIR}"
while true
do
if [[ "$FileLoad" == ‘/’ ]]; then return; fi
echo "$FileLoad" |grep -q ‘/’;
if [[ "$?" == "0" ]]; then
FileLoad=$(dirname "$FileLoad");
else
break;
fi;
done;
if [[ "$FileLoad" == "$LocalDIR" ]]; then return; fi
#EXEC1="$(command -v python)"
EXEC1="python"
EXEC2="/root/PyOne/function.py"
if [[ -z "$EXEC1" ]] ; then return; fi
cd "$LocalDIR";
if [[ -e "$FileLoad" ]]; then
ItemSize=$(du -s "$FileLoad" |cut -f1 |grep -o ‘[0-9]*’ |head -n1)
if [[ -z "$ItemSize" ]]; then return; fi
if [[ "$ItemSize" -le "$MinSize" ]]; then
echo -ne "\033[33m$FileLoad \033[0mtoo small to spik.\n";
return;
fi
if [[ "$ItemSize" -ge "$MaxSize" ]]; then
echo -ne "\033[33m$FileLoad \033[0mtoo large to spik.\n";
return;
fi
eval "${EXEC1} ${EXEC2}${Option}" \’"$LocalDIR${FileLoad}"\’ "${RemoteDIR}" "${DiskFlag}";
#${EXEC1} ${EXEC2}${Option} $LocalDIR${FileLoad} ${RemoteDIR} ${DiskFlag} ;
if [[ $? == ‘0’ ]]; then
rm -rf "$FileLoad";
fi
fi
fi
IFS=$IFS_BAK
}
LoadFile;
西藏网友:https://raw.githubusercontent.com/weiyidu/OneDrive/master/autoupload_new.sh