惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
博客园 - Franky
V
V2EX
Last Week in AI
Last Week in AI
H
Help Net Security
J
Java Code Geeks
WordPress大学
WordPress大学
阮一峰的网络日志
阮一峰的网络日志
Hugging Face - Blog
Hugging Face - Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
A
About on SuperTechFans
月光博客
月光博客
腾讯CDC
小众软件
小众软件
罗磊的独立博客
D
Docker
V
Visual Studio Blog
C
CXSECURITY Database RSS Feed - CXSecurity.com
Spread Privacy
Spread Privacy
博客园 - 叶小钗
F
Full Disclosure
Recent Announcements
Recent Announcements
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
L
LangChain Blog
T
The Exploit Database - CXSecurity.com
宝玉的分享
宝玉的分享
美团技术团队
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
L
LINUX DO - 热门话题
博客园 - 三生石上(FineUI控件)
T
Tailwind CSS Blog
www.infosecurity-magazine.com
www.infosecurity-magazine.com
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
S
Securelist
Latest news
Latest news
Project Zero
Project Zero
T
Threat Research - Cisco Blogs
NISL@THU
NISL@THU
K
Kaspersky official blog
O
OpenAI News
T
Tenable Blog
C
Cyber Attacks, Cyber Crime and Cyber Security
Cyberwarzone
Cyberwarzone
Vercel News
Vercel News
有赞技术团队
有赞技术团队
P
Proofpoint News Feed
爱范儿
爱范儿
B
Blog RSS Feed
U
Unit 42

IT Notes - series

IT Notes IT Notes IT Notes IT Notes IT Notes IT Notes IT Notes IT Notes IT Notes IT Notes IT Notes IT Notes IT Notes IT Notes IT Notes IT Notes IT Notes IT Notes
IT Notes
Stefano Marinelli · 2024-07-11 · via IT Notes - series

FreeBSD allows for quite comprehensive resource limitation for one or more jails. Beyond the official documentation, there is a good description in MWL's book. There's also an interesting article from Klara Systems that describes some functionalities.

Sometimes, however, we only need the processes running within a specific jail to have a specific priority - higher or lower than others.

There are many methods to achieve this, but the simplest one, in my opinion, is to leverage the properties of the nice(1) command. The main property, in fact, is to transmit the set priority to child processes, so all processes launched by the command that received a different level of "niceness" will inherit its priority.

For example, to give the minimum priority to the services launched within a jail, just modify the .conf file of the jail (in the case of a standard BastilleBSD installation, the file will be /usr/local/bastille/jails/jailname/jail.conf) and change the command

exec.start = '/bin/sh /etc/rc';

to:

exec.start = '/usr/bin/nice -n 20 /bin/sh /etc/rc';

In this way, when rc starts at the jail's boot, it will have a niceness of 20 and will transmit it to all the processes that rc itself launches (thus all the services of the jail).

Note: This will only apply to child processes of rc, not to:

  • Commands manually launched from the jail console
  • Services launched by running service servicename start (or restart) from the jail shell. This is because, in this case, the process will not be a child of rc but will derive directly from the console in use.

Using the nice command to set the priority of processes within a FreeBSD jail is a simple and effective method. However, it is important to be aware of the limitations of this approach and ensure that manually executed commands are managed accordingly.