在使用群辉大量下载时遇到Too many open files问题,查阅相关资料后发现tr的limit数是写死的。这里使用C程序动态修改tr的limit数。
1.创建一个limit.C源文件并输入如下代码
#include <stdio.h>
#include <sys/time.h>
#include <sys/resource.h>
#include <sys/types.h>
int main(int argc, char** argv) {
pid_t pid;
struct rlimit new_limit;
int result;
if (argc < 2) {
return 1;
}
pid = atoi(argv[1]);
new_limit.rlim_cur = 60000;
new_limit.rlim_max = 60000;
result = prlimit(pid, RLIMIT_NOFILE, &new_limit, NULL);
return result;
}
2.编译程序
使用安装好的GCC编译器编译程序,/opt/bin/gcc limit.c -o limit
3.运行程序修改tr limit 数量
先获取tr的pidps -ef | grep transmission
然后使用./limit 刚刚获取的pid
修改tr的limit数量即可。
%%
%%
%%
%%
%%
First off I would like to say awesome blog! I had a quick question in which I'd like to
ask if you don't mind. I was curious to know how you center yourself and clear your head prior to writing.
I've had a difficult time clearing my mind in getting my thoughts out.
I truly do take pleasure in writing but it just seems
like the first 10 to 15 minutes are usually
lost simply just trying to figure out how to begin. Any recommendations or hints?
Many thanks!
%%
%%
%%
%%
%%
%%
%%
%%
Way cool! Some very valid points! I appreciate you penning
this article plus the rest of the site is also very good.
%%
We absolutely love your blog and find the majority of
your post's to be just what I'm looking for. Do you offer
guest writers to write content for yourself? I wouldn't mind creating
a post or elaborating on a lot of the subjects you write concerning here.
Again, awesome web log!
[url=https://celexa.directory/]celexa 15 mg[/url]
%%
%%