Results 1 to 1 of 1
Can anyone help me with this script? Monitor processes on a remote system a.) Bash script located on server1 which takes the hostname of the remote system as the only ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 03-25-2006 #1
- Join Date
- Mar 2006
Monitor processes on a remote system
a.) Bash script located on server1 which takes the hostname of the remote system as the only parameter .
The tasks of the script are:
- Use authentication keys to get the required information from the remote system
- Use top in its batch mode to monitor the processes on the remote system.
- HINT: When calling top on a remote system it will most likely complain about “TERM environment variable not set.” Use “TERM=xterm top …” to execute top.
- The delay between the cycles of top shall 5 seconds.
- Execute top for 12 cycles (i.e. one minute in total).
- Write the output of top to a file located in /tmp. The syntax of the file name has to be like this one /tmp/top-[hostname]-[date]. An example would be /tmp/top-server2-2004-09-12-10:13
Be sure to use the actual hostname of the machine top is running on, do not set this by default to “server2”! The script shall be flexible
For the date information use the time when starting top.
- After finishing top, the log file created has to be copied to the directory /var/log/top on server1.
- After coping the file to server1, delete it on the remote machine.