sword

群晖transmission报错解决记录( Unable to save resume file: Too many open files)
概述最近群晖使用transmission过一段时间就报错Unable to save resume file: T...
扫描右侧二维码阅读全文
04
2021/01

群晖transmission报错解决记录( Unable to save resume file: Too many open files)

概述

最近群晖使用transmission过一段时间就报错Unable to save resume file: Too many open files,可能是做种数量太多了吧,查了一下linux默认是1024的打开文件数,但是呢群晖没有这个配置文件可以修改,百度了一下已经有解决方案了,于是抄下来记录一下!

原文地址:https://piaoyun.cc/1369.html

方法一:

1、编辑 /etc/profile 文件

2、最后一行加入(群晖官方说最大只能4096)

ulimit -n 4096

3、配置生效,执行

source /etc/profile

4、局限性:只适用于root用户,对普通登录用户依然是1024,最大只能4096,保种不多的可以考虑

方法二:

依次执行以下命令
1、下载编译好的二进制程序

wget https://www.mopsky.com/rlimit 

2、更改rlimit程序的权限

chmod 744 rlimit 

3、查找transmission的进程编号

ps -ef|grep transmission  #返回的数字即为 pid 

4、使用rlimit工具对进程进行更改

./rlimit 进程编号

5、查看是否生效

cat /proc/进程编号/limits

6、rlimit源码(C程序,群晖不自带GCC编译器,需要自己折腾编译,不懂得可以用以上5步即可)

#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;
}

注:每次启动transmission得进程编号可能不一样,需要对于启动修改(执行3-5步)

Last modification:January 4th, 2021 at 07:39 pm
If you think my article is useful to you, please feel free to appreciate

Leave a Comment