-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
脚本有问题 #13
Comments
我觉得没有问题吧,如果无法执行,大概是因为权限问题,readme里的文档有写
|
新版本好像还是不行,我改成这样就可以
|
今天抽时间研究了一下aria2的参数传递,更新了删除文件的脚本,经过测试删除功能正常运行,删除功能已完善 |
我在群晖里面还是不行,$3是带有扩展名的~你的这个删除时有扩展名就出错 |
这个脚本是这样的,它做了几个判断,在aria2里,如果下载的一个文件夹里带多个文件,那么aria2文件会在上一级目录,我在shell写了截取目录的命令,所以可以正确截取目录,
````
dirpath=${filepath%/*}
elif [ "$path" != "$filepath" ] && [ $2 -gt 1 ]
then
[ -e "$dirpath".aria2 ] && rm -vrf "$dirpath".aria2 "$dirpath"
exit 0
````
|
我的建议是你删除容器,重新建一个,脚本估计是因为你修改过所以没被替换 |
容器更新过了,我容器看过了,是最新的脚本。 我用echo [$(date)] $filepath " [Wed Feb 26 19:19:33 CST 2020] m1 , /downloads/trackers_all.txt 但是.aria2文件是/downloads/abcd.aria2 #!/bin/bash downloadpath='/downloads' filepath=$3 if [ $2 -eq 0 ] |
因为是有文件数量的判断,大于二的文件数是有文件夹的,所以删除的是dirpath,一个文件直接删除filepath就可以
zlx42 <notifications@github.com>于2020年2月26日 周三下午10:07写道:
… 容器更新过了,我容器看过了,是最新的脚本。
我用echo [$(date)] $filepath "
" >> /config/_log.html输出记录的是
/downloads/abcd/abcd.mp4之类的,
[Wed Feb 26 19:19:33 CST 2020] m1 , /downloads/trackers_all.txt
[Wed Feb 26 20:59:41 CST 2020] m3 , /downloads/abcd.mp4
但是.aria2文件是/downloads/abcd.aria2
感觉应该是你的filepath直接用的$3,是带扩展名的,你的脚本目前只有dirpath是正确的,其他的只要用[ -e
"$filepath".aria2 ] && rm -vf
"$filepath".aria2都会变成/downloads/abcd/abcd.mp4.aria2这样的就删除失败了。。。。
#!/bin/bash
downloadpath='/downloads'
filepath=$3
rdp=${filepath#${downloadpath}/}
path=${downloadpath}/${rdp%%/
*} dirpath=${filepath%/*}
if [ $2 -eq 0 ]
then
exit 0
elif [ "$path" = "$filepath" ] && [ $2 -eq 1 ]
then
[ -e "$filepath".aria2 ] && rm -vf "$filepath".aria2
*echo [$(date)] m1 , $filepath "" >> /config/_log.html*
exit 0
elif [ "$path" != "$filepath" ] && [ $2 -gt 1 ]
then
[ -e "$dirpath".aria2 ] && rm -vf "$dirpath".aria2
*echo [$(date)] m2 , $dirpath "" >> /config/_log.html*
exit 0
elif [ "$path" != "$filepath" ] && [ $2 -eq 1 ]
then
[ -e "$*dirpath*".aria2 ] && rm -vf "$filepath".aria2
echo [$(date)] m1 ,$dirpath "
" >> /config/_log.html
exit 0
—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
<#13?email_source=notifications&email_token=AG2C73SPYQT5ECPNP3RYMPTREZZSJA5CNFSM4JXRDLD2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOENALMBQ#issuecomment-591443462>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AG2C73W5XUPFZOKAOCI6PO3REZZSJANCNFSM4JXRDLDQ>
.
|
都说了按输出的记录显示filepath内容使用扩展名的,你用dirpath之类的都是对的,但是用filepath输出的都带扩展名。 [Wed Feb 26 19:19:33 CST 2020] m1 , /downloads/trackers_all.txt "$filepath" 的内容是 /downloads/abcd.mp4 ,所以命令输出就会变成/downloads/abcd.mp4.aria2 |
我在群晖里装的,脚本判断有问题,好像没把path里的扩展名去掉,导致出错
path=${path%%.*}之类的?
The text was updated successfully, but these errors were encountered: