简体   繁体   English

awk shell脚本帮助

[英]awk shell script help

i have the output of cat /proc/loadavg and /proc/meminfo MemFree: 1191220 kB 我有cat / proc / loadavg和/ proc / meminfo MemFree的输出:1191220 kB

i need a to know who will i get a script to get then added in a logfile every 5 mins. 我需要知道谁将获得脚本,然后每5分钟将其添加到日志文件中。

eg: CPU; 例如:CPU; Mem; 内存;

10.0;   1191220

and so on so the next entry will be below that 依此类推,因此下一个条目将低于该条目

eg: CPU; 例如:CPU; Mem m

10.0;      1191220
5.0;        2229882

Thanks in advance 提前致谢

First you will need to write a shell script which execute loadavg and meminfo and add there output into your desired log file. 首先,您将需要编写一个执行loadavgmeminfo的shell脚本,并将那里的输出添加到所需的日志文件中。 Now you can get this script repeatedly executed by cron by setting up a cron task. 现在,您可以通过设置cron任务来使该脚本由cron重复执行。 To setup cron task you will need to add entry into /etc/crontab . 要设置cron任务,您需要将条目添加到/etc/crontab For details you can consult man entries for cron and crontab. 有关详细信息,您可以查阅有关cron和crontab的手册条目。

Also I think this questions is more suited to serverfault.com 我也认为这个问题更适合serverfault.com

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM