Presumably the requirement is that the AIX system Usysfault command takes the fault light information, but this command appears to be performed only by the root user, and the other user executes the error. All sorts of ways to empower all fail, so think of writing a shell script with the root user to execute the results are written to the log file, and then we read the file to fetch the data, we do not have to execute the AIX or not let us execute the command.
The shell script is as follows:
! /usr/bashwhile true #循环执行do { date + "%y-%m-%d%h:%m:%s" #取当前日期和时间 uname #要执行的命令 } > Patrol.log #输出到日志sleep 5 #执行周期是5秒done
This script is to take the host system type and time into the log log file, the log is overwritten storage is not appended, always only one record.
With the command:
SH patrol.sh &
Run the script in the background to always loop through the number.
Shell script that executes system commands and writes output to a log file