[英]Creating bash script
How to create a bash script that runs periodically through a cronjob to gather readings of a running processes on the current machine (1 sample per process on each run ) from the system the readings are: 1 CPU load percentage. 如何创建从cronjob定期运行的bash脚本,以从系统中收集当前计算机上正在运行的进程的读数(每次运行每个进程1个样本),读数为:1 CPU负载百分比。 2 Memory Usage.
2内存使用情况。 3 Open files count.
3打开文件数。 4 Open ports count.
4个开放端口数。
I gues you could iterate through /proc
filesystem analysing files uid
and stat*
. 我猜想您可以遍历
/proc
文件系统来分析文件uid
和stat*
。 Then the uid needs to be mapped to /etc/passwd
to get real user names. 然后,需要将uid映射到
/etc/passwd
以获得真实的用户名。 In my opinion a perl script would be more convenient for this need. 在我看来,Perl脚本可以更方便地满足这种需求。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.