- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Script to get the report of the process runni...
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-29-2011 02:10 PM
03-29-2011 02:10 PM
I need you valuable belp in creating a script that will login 30 servers and create a report of the process run by users other that root.
Regards
-Binu
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-29-2011 02:36 PM
03-29-2011 02:36 PM
SolutionWhat have you tried?
I suggest using 'ssh -n
Something driven like:
while read HOST
do
ssh -n ${HOST} ps -ef
done < /home/binu/hostnames
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-30-2011 05:53 AM
03-30-2011 05:53 AM
Re: Script to get the report of the process running in 30 Servers
for this you will need at least the following:
- a file containing the name of the servers
- ssh keyed access (you don't want to type all the passwords per hand, do you?)
anyway, a while loop would do this, see above...
Unix operates with beer.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-30-2011 06:06 AM
03-30-2011 06:06 AM
Re: Script to get the report of the process running in 30 Servers
Where can I mention the host file details in the the script
Regards
-Binu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-30-2011 06:10 AM
03-30-2011 06:10 AM
Re: Script to get the report of the process running in 30 Servers
it is in the last line, where you specify that file. in our case it's /home/binu/hostnames :
#
while read HOST
do
ssh -n ${HOST} ps -ef
done < /home/binu/hostnames
#
Unix operates with beer.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-30-2011 06:15 AM
03-30-2011 06:15 AM
Re: Script to get the report of the process running in 30 Servers
> Where can I mention the host file details in the the script
The file that I showed in my example --- '/home/binu/hostnames' simply consists of a server's hostname, one name per line of the file.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-30-2011 06:23 AM
03-30-2011 06:23 AM
Re: Script to get the report of the process running in 30 Servers
Where will be the output of ps -ef get stored ..Is it possible to store the output of ps -ef of all servers in a single file.
Regards
-Binu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-30-2011 06:30 AM
03-30-2011 06:30 AM
Re: Script to get the report of the process running in 30 Servers
yes, use redirection:
while read HOST
do
ssh -n ${HOST} ps -ef
done < /home/binu/hostnames 1> /home/binu/output 2>&1
Unix operates with beer.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-30-2011 07:41 AM
03-30-2011 07:41 AM
Re: Script to get the report of the process running in 30 Servers
and Is there way to arrange the output file according to the hostname
Regards
-Binu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-30-2011 11:37 AM
03-30-2011 11:37 AM
Re: Script to get the report of the process running in 30 Servers
If you don't know how to do this, I personally described this process at least in 10 different posts. Look at my answer history and find one of those. It is not hard but it needs precise execution for file ownerships and permissions.
Or search google for creating shh keys for passwordless login and you will find a tgon of documents explaining how to do this.
UNIX because I majored in cryptology...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-30-2011 12:04 PM
03-30-2011 12:04 PM
Re: Script to get the report of the process running in 30 Servers
while read HOST
do
ssh -n ${HOST} hostname
ssh -n ${HOST} ps aux | grep -v root
done < /home/binu/scripts/hostnames 1> /home/binu/scripts/output 2>&
Thanks
-Binu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-30-2011 12:14 PM
03-30-2011 12:14 PM
Re: Script to get the report of the process running in 30 Servers
What does that tell you that you didn't
already know?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-30-2011 12:29 PM
03-30-2011 12:29 PM
Re: Script to get the report of the process running in 30 Servers
Looks like this
cpaiqp4a
USER PID %CPU %MEM SZ RSS TTY STAT STIME TIME COMMAND
tauser02 1396842 0.9 9.0 1385060 1385096 - A Mar 22 824:12 /opt/isv/WAS51
tauser02 3653858 0.4 9.0 1380776 1380812 - A Mar 22 350:33 /opt/isv/WAS51
www 4370646 0.1 2.0 283820 283588 - A Feb 28 243:21 /opt/isv/IBMIH
tauser02 4788304 0.0 1.0 136920 136956 - A Feb 28 55:44 /opt/isv/WAS51
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-30-2011 01:04 PM
03-30-2011 01:04 PM
Re: Script to get the report of the process running in 30 Servers
> with hostname [...]
Something simple (and local) might be faster:
echo ${HOST}
You're giving the name of the remote host to
"ssh", so that you can ask the remote host to
tell you its name? (I can imagine cases
where you might get a different answer back,
but none seems very likely.)
If you really want the name from the remote
host, do you need two "ssh" sessions?
> ssh -n ${HOST} ps aux | grep -v root
That does the "ps" on the other system, but
it does the "grep" locally, doesn't it? I
haven't tested it, but I'd try to do all the
work on the remote system:
ssh -n ${HOST} 'ps aux | grep -v root'
And, if that worked, then I'd try something
like:
[...] 'hostname ; ps aux | grep [...]'
in _one_ "ssh" command.