Advertisement

06.12.2008 at 12:30AM PDT, ID: 23478526
[x]
Attachment Details

Checking multiple systems with command "Top" using a Linux Script

Asked by Ryman1 in Debian Linux, Linux Programming, Linux Administration

I am using the script below to check systems using the command top, but since Top requires "q" to terminate, it fails.

Is there a line I can put in the script to say q?

Here is the output I get:

=====================================================================
Host ops1corp at IP 192.168.1.236 is running the following services
=====================================================================
TERM environment variable not set.
 
=====================================================================
Host ops2corp at IP 192.168.1.237 is running the following services
=====================================================================
TERM environment variable not set.
 
=====================================================================
Host www1stg at IP 192.168.1.238 is running the following services
=====================================================================
TERM environment variable not set.
Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
#!/bin/bash
 
# loop that checks each system in iprange specified
for i in $(seq 236 238)
do
  ip=192.168.1.$i
  host=$(ssh $ip -C hostname 2>&1)
  echo " "
  echo "====================================================================="
  echo "Host $host at IP $ip is running the following services"
  echo "====================================================================="
  ssh $ip "top"
done > topcheckfile 2>&1
[+][-]06.12.2008 at 12:35AM PDT, ID: 21766911

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Debian Linux, Linux Programming, Linux Administration
Sign Up Now!
Solution Provided By: shakoush2001
Participating Experts: 1
Solution Grade: B
 
 
[+][-]06.12.2008 at 11:37AM PDT, ID: 21772396

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.12.2008 at 11:57AM PDT, ID: 21772582

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.12.2008 at 03:29PM PDT, ID: 21774238

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628