4.6 监测用户
查看哪些用户正在使用你的系统,主要命令:
l w what users are logged in and for how long?
l who users, ports, login times
l whodo users, ports, login times, commands
l finger detailed user information
l last login history by userid or tty port
l /var/adm/sulog history of switch user command usage
4.6.1. w,who,whodo,finger,finger -l,last
查看哪些用户登录了你的系统。
命令:
#(%) w
#(%) who
#(%) whodo
#(%) finger
注:使用了/etc/passwd的GECOS字段以提供额外信息。
#(%) finger -l
#(%) last jwag
注:从/etc/wtmp中根据用户ID和tty端口过滤出来的该用户以前的登录信息。
4.6.2. /var/adm/sulog
查看su (switch user command usage)的登录成功与否(+/-);
# tail /var/adm/sulog
注:只有root和adm权限才能查看sulog
# ls -l /var/adm/sulog
4.7 进程管理
至此我们已经了解了如何去查看“系统正在运行什么”的命令,那么,下一步,我们该做那些事情来对现有的系统资源进行操作?
4.7.1. 调整一个“慢速”系统
若你的用户抱怨他/她的机器运行速度比正常的慢,那么你就应该采用上文讲到的系统监测工具来查看哪个进程占用了大量的系统资源。
1,用top命令来查询大量侵占CPU的进程;
2,你应帮助用户裁决他/她的进程之所以大量侵占CPU时间的原因。
4.7.2. “杀死”一个进程
命令格式:
# kill –signalnumber processIDnumber
signalnumber主要有:
# kill PID
# kill –01 PID ;hangup
# kill –02 PID ;interrupt
# kill –03 PID ;quit
# kill –05 PID ;trace trap(not set when caught)
# kill –06 PID ;abort
# kill –09 PID ;Kill (cannot be caught or ignored)
# kill –10 PID ;bus error
# kill –11 PID ;segmentation violation
# kill –12 PID ;bad argment to system call
# kill –15 PID ;software termination signal(default)
4.7.3. 操作进程的调度优先级
IRIX操作系统允许系统管理员对进程的优先级进行多项操作,你能控制:
l 按何种序列(what order)将进程规划到CPU;
l 进程在CPU中运行多长时间(how long);
l 进程使用CPU的频率(how often)
进程规划属性可按下述方式更改:
l NDPRI set or remove non-degrading priority
l RENICE relative “nice-ness” value
l SLICE size of process’s time slice in the cpu
l DEADLINE periodic deadline scheduling (uew IRIX feature)
see: #man schedctl 以获取细节信息。
note: System and Program tuning is covered in detail in the Advanced System  Administration and Real Time workshops.
操作进程的规划优先级命令:
所有进程的优先级之值都可由内核来设置,优先级之值特点:
l range from 0~254
l are banded into subranges
l have meaning relative to other process’s priorities
l may change over time (degrade or upgrade)
命令:
命令 更改类型
Npri absolute or relative,set non-degrading, time slice, deadline schduling.A super-user can use npri to change the priority of a user’s process.one could change the:priority, making it non-degrading     {-h}absolute ‘nice-ness’ value           {-n}time slice for the process            {-t}
Nice relative modifier, regular users can lower their priority.changes the priority of a time-sharing process.giving your processes a lower scheduling priority.Two kinds of nice command:build into the c-shell (/bin/csh)called from other types of shells - /sbin/niceExample:% nice -10 ls

下面来回答4.7.1的问题。即:
问题:
1. pat(一个用户)的进程侵占了大量的系统资源;
2. pat本人不原意nice他/她的进程,也不想在晚上工作;
3. 许多其他用户又必须完成其工作。

超级用户就应立刻进行拯救!
1. 用ps查看pat进程的PID号;
2. 用npri更改pat进程的优先到254(最低优先级)
# npri -h 254 -p <PID>
这样pat的进程仍能运行,但只能在系统不忙时方可。
# ps -el查看更改后进程状况。
4.8 监测IRIX系统小节
l 理解IRIX进程
什么是进程,我们为什么要关心进程是如何工作的?
l 监测系统行为
我们能用哪些工具来监测我们的系统?
l 监测用户
我们能用哪些工具来查看我们的用户在做些什么?
l 管理进程
我们能对系统作哪些操作来确保系统高效运作?