24小时热门版块排行榜    

查看: 974  |  回复: 3

sunmuer

木虫 (小有名气)

[求助] 如何限制用户使用的cpu数

有一台HP的服务器,用户有4个左右。
如何去限制用户使用的cpu数呢?

或者能够限制用户使用的硬盘空间也行。

在google上找到一个用quota之类的命令操作的,看的有点晕。
有高手详细指点将感激不尽。
回复此楼
出清水而不染
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

sunmuer

木虫 (小有名气)

我看了下鸟哥的私房菜-linux基础篇,找到了如何限制硬盘使用。资料在下面的链接中:
http://muchong.com/bbs/viewthread.php?tid=4102177&fpage=1
但是如何限制用户使用CPU数还是没有发现适用的方法。
出清水而不染
2楼2012-04-06 09:07:56
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

我的小名

木虫 (小有名气)

【答案】应助回帖

事实上,俺早就看上这个帖子了。
但是俺为什么几个月都没回帖呢?!
其实俺也不知道。
今天做量子力学作业做得心情不好,偶然间看到陈年老帖子,决定来散散心。

实际上,要限制用户使用的CPU一定是通过系统设置实现的。
那就很明显了,系统,LZ您用的是什么系统呢?不同的系统有不同情况,你不和俺说,俺怎么帮你解决问题呢!

那俺就猜你用的是opensuse12.2(为什么是这个系统呢?因为俺用的就是她):
/etc/security/limits.conf
当你找到这份文件的时候,一切问题都成浮云了。
俺们了看看里面都写了些啥:
======================================================(此线不在文件内,俺不知道为啥画了这)
# /etc/security/limits.conf
#
#Each line describes a limit for a user in the form:
#
#            
#
#Where:
# can be:
#        - an user name
#        - a group name, with @group syntax
#        - the wildcard *, for default entry
#        - the wildcard %, can be also used with %group syntax,
#                 for maxlogin limit
#
# can have the two values:
#        - "soft" for enforcing the soft limits
#        - "hard" for enforcing hard limits
#
# can be one of the following:
#        - core - limits the core file size (KB)
#        - data - max data size (KB)
#        - fsize - maximum filesize (KB)
#        - memlock - max locked-in-memory address space (KB)
#        - nofile - max number of open files
#        - rss - max resident set size (KB)
#        - stack - max stack size (KB)
#        - cpu - max CPU time (MIN)
#        - nproc - max number of processes
#        - as - address space limit (KB)
#        - maxlogins - max number of logins for this user
#        - maxsyslogins - max number of logins on the system
#        - priority - the priority to run user process with
#        - locks - max number of file locks the user can hold
#        - sigpending - max number of pending signals
#        - msgqueue - max memory used by POSIX message queues (bytes)
#        - nice - max nice priority allowed to raise to values: [-20, 19]
#        - rtprio - max realtime priority
#
#                 
#

#*               soft    core            0
#*               hard    rss             10000
#@student        hard    nproc           20
#@faculty        soft    nproc           20
#@faculty        hard    nproc           50
#ftp             hard    nproc           0
#@student        -       maxlogins       4

# End of file
========================================================

不多不少,10个金币,谢谢!
俺不贪心,你说是吧!
ElCondorPasa
3楼2012-10-09 21:38:41
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

我的小名

木虫 (小有名气)

为什么俺只要了一半的金币呢?
因为俺是好人!
为什么好人就只要一半金币呢?
好人做到底啊!
在不久的将来另一半也是俺的!
ElCondorPasa
4楼2012-10-09 21:43:52
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
相关版块跳转 我要订阅楼主 sunmuer 的主题更新
信息提示
请填处理意见