HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Output from several SSH server's several files...
Operating System - HP-UX
1833648
Members
4354
Online
110062
Solutions
Forums
Categories
Company
Local Language
back
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
back
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
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Topic Options
- 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
06-22-2007 04:26 AM
06-22-2007 04:26 AM
Output from several SSH server's several files into single file
I have 2 input files - has server names and its residing db names in them. Now I would like to go to each server (from 1st file) and then to one of server's db (from 2nd file). Then to a particular path and to store contents of some files from this path to another file. This task is needed for all (~500) dbs of all (~10) Servers. Below is kinda prototype:
1) ssh
2) go [will take to the directory of selected db from second file]
3) cdpf [will take to the directory from where i need output]
4) cat a*pst.pf >> outofpf.lst
5) ssh
...
Please advice how can it be done efficiently.
Thank you!
1) ssh
2) go
3) cdpf [will take to the directory from where i need output]
4) cat a*
5) ssh
...
Please advice how can it be done efficiently.
Thank you!
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-22-2007 04:31 AM
06-22-2007 04:31 AM
Re: Output from several SSH server's several files into single file
How do you know which DB is on which server. The two input files need to be joined on a common field or some sort of correlation has to exist between the two in order to make this viable. Could you provide a sample listing of the contents of the two input files.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-24-2007 10:13 PM
06-24-2007 10:13 PM
Re: Output from several SSH server's several files into single file
Actually, I was wrong. I have only one input file - which has entries of db names. E.g. 001
002
003
The script I had tried with is:
for db_cnt in `cat /home/mfgeb/pp/db-file.txt`
do
go $db_cnt "cdpf;
head -8 a*`$db_cnt`pst.pf" >> db.out;
done
db-file : Has names of databases. There is one inbuilt script I have 'go' which takes to the corresponding server of supplied DB. Its like ssh command. But ssh command works only with server name. go command can have input of only db name and then it will internally figure out its server name and then ssh to that server. Then 'cdpf' is the script which will change directory to a specific path. From that directory I want values of some files and to be kept them stored in some output file for all DBs.
Pls suggest!
002
003
The script I had tried with is:
for db_cnt in `cat /home/mfgeb/pp/db-file.txt`
do
go $db_cnt "cdpf;
head -8 a*`$db_cnt`pst.pf" >> db.out;
done
db-file : Has names of databases. There is one inbuilt script I have 'go' which takes to the corresponding server of supplied DB. Its like ssh command. But ssh command works only with server name. go command can have input of only db name and then it will internally figure out its server name and then ssh to that server. Then 'cdpf' is the script which will change directory to a specific path. From that directory I want values of some files and to be kept them stored in some output file for all DBs.
Pls suggest!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-25-2007 01:40 AM
06-25-2007 01:40 AM
Re: Output from several SSH server's several files into single file
Hey;
I'm not real clear on what you're trying to do. It looks like you're trying to get the first 8 lines of a particular file from a list of servers. Let me know if that's accurate.
In command execution mode, ssh typically has a very limited environment. Not as limited as cron, for instance, but still, not what you get when you fully log into the box. Therefore, if "go" isn't in /usr/bin or /bin, ssh probably won't find it.
Your best bet would be to create a datafile such as:
Host1 DB1 path_to_pst.pf
Host1 DB2 path_to_pst.pf
Host2 DB3 path_to_pst.pf
Host3 DB4 path_to_pst.pf
from that:
cat ${data_file} | while read h d p
do
ssh -n ${h} "head -8 ${p}/a*${d}" >> outofpf.lst
done
You'll need the -n option on the ssh call because of the cat file | while read construct. You'll get errors otherwise.
HTH;
Doug
------
Senior UNIX Admin
O'Leary Computers Inc
linkedin: http://www.linkedin.com/dkoleary
Resume: http://www.olearycomputers.com/resume.html
I'm not real clear on what you're trying to do. It looks like you're trying to get the first 8 lines of a particular file from a list of servers. Let me know if that's accurate.
In command execution mode, ssh typically has a very limited environment. Not as limited as cron, for instance, but still, not what you get when you fully log into the box. Therefore, if "go" isn't in /usr/bin or /bin, ssh probably won't find it.
Your best bet would be to create a datafile such as:
Host1 DB1 path_to_pst.pf
Host1 DB2 path_to_pst.pf
Host2 DB3 path_to_pst.pf
Host3 DB4 path_to_pst.pf
from that:
cat ${data_file} | while read h d p
do
ssh -n ${h} "head -8 ${p}/a*${d}" >> outofpf.lst
done
You'll need the -n option on the ssh call because of the cat file | while read construct. You'll get errors otherwise.
HTH;
Doug
------
Senior UNIX Admin
O'Leary Computers Inc
linkedin: http://www.linkedin.com/dkoleary
Resume: http://www.olearycomputers.com/resume.html
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Events and news
Customer resources
© Copyright 2025 Hewlett Packard Enterprise Development LP