翔云

Just try, don't shy. 最新文章请点击
  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

cgred不能自动将pid放入tasks

Posted on 2018-09-02 21:59  翔云123456  阅读(137)  评论(0编辑  收藏  举报

问题:

cgred不能自动将pid放入tasks
cgred / cgrulesengd - does not move new user pid to task file

https://serverfault.com/questions/724958/cgred-cgrulesengd-does-not-move-new-user-pid-to-task-file

该问题尚在找到原因,哪位大神如果知道,麻烦告知下。

cgred 守​​​护​​​进​​​程​​​

Cgred 是​​​一​​​个​​​守​​​护​​​进​​​程​​​,它​​​可​​​根​​​据​​​在​​​ /etc/cgrules.conf 文​​​件​​​中​​​设​​​定​​​的​​​参​​​数​​​将​​​任​​​务​​​移​​​动​​​到​​​ cgroup 中​​​。​​​/etc/cgrules.conf 文​​​件​​​中​​​的​​​条​​​目​​​可​​​以​​​使​​​用​​​以​​​下​​​两​​​个​​​格​​​式​​​之​​​一​​​:

user hierarchies control_group
user:command hierarchies control_group

例​​​如​​​:

maria			devices		/usergroup/staff

这​​​个​​​条​​​目​​​指​​​定​​​任​​​何​​​属​​​于​​​名​​​为​​​ maria 用​​​户​​​的​​​进​​​程​​​根​​​据​​​在​​​ /usergroup/staff cgroup 中​​​指​​​定​​​的​​​参​​​数​​​访​​​问​​​设​​​备​​​子​​​系​​​统​​​。​​​要​​​将​​​具​​​体​​​命​​​令​​​与​​​具​​​体​​​ cgroup 关​​​联​​​,请​​​添​​​加​​​ command 参​​​数​​​,如​​​下​​​:

maria:ftp		devices		/usergroup/staff/ftp

该​​​条​​​目​​​现​​​在​​​指​​​定​​​何​​​时​​​名​​​为​​​ maria 的​​​用​​​户​​​使​​​用​​​ ftp 命​​​令​​​,自​​​动​​​将​​​该​​​进​​​程​​​移​​​动​​​到​​​包​​​含​​​ devices 子​​​系​​​统​​​的​​​层​​​级​​​中​​​的​​​ /usergroup/staff/ftp cgroup 中​​​。​​​请​​​注​​​意​​​:该​​​守​​​护​​​进​​​程​​​只​​​有​​​在​​​符​​​合​​​适​​​当​​​的​​​条​​​件​​​后​​​才​​​可​​​将​​​该​​​进​​​程​​​移​​​动​​​到​​​该​​​ cgroup 中​​​。​​​因​​​此​​​,ftp 可​​​能​​​会​​​在​​​错​​​误​​​的​​​组​​​群​​​中​​​短​​​暂​​​运​​​行​​​。​​​再​​​有​​​,如​​​果​​​该​​​进​​​程​​​在​​​错​​​误​​​组​​​群​​​中​​​迅​​​速​​​生​​​出​​​子​​​进​​​程​​​,则​​​不​​​会​​​移​​​动​​​这​​​些​​​子​​​进​​​程​​​。​​​

/etc/cgrules.conf 文​​​件​​​中​​​的​​​条​​​目​​​可​​​包​​​括​​​以​​​下​​​额​​​外​​​符​​​号​​​:
@ - 当​​​在​​​ user 使​​​用​​​前​​​缀​​​时​​​,代​​​表​​​是​​​一​​​个​​​组​​​群​​​而​​​不​​​是​​​单​​​独​​​用​​​户​​​。​​​例​​​如​​​:@admins 是​​​ admins 组​​​群​​​中​​​的​​​所​​​有​​​用​​​户​​​。​​​

    • 代​​​表​​​“​​​所​​​有​​​”​​​。​​​例​​​如​​​:subsystem 字​​​段​​​中​​​的​​​ * 代​​​表​​​所​​​有​​​子​​​系​​​统​​​。​​​
      % - 代​​​表​​​与​​​以​​​上​​​行​​​中​​​项​​​目​​​相​​​同​​​的​​​项​​​目​​​。​​​例​​​如​​​:
@adminstaff		devices		/admingroup
@labstaff		%		%

参考

https://access.redhat.com/documentation/zh-cn/red_hat_enterprise_linux/6/html/resource_management_guide/sec-moving_a_process_to_a_control_group