HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: need a script to copy a file to 5 servers
Operating System - HP-UX
1834020
Members
2824
Online
110063
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
Go to solution
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
08-20-2005 11:19 AM
08-20-2005 11:19 AM
Hi,
I need to copy a file from server1:/tmp/test.tar to other servers(server2,3,4,5,6..:/home/user1/TST)directory.
The TST directory needs to be created before copying the file. I tried ssh from server1 (ssh server2 "mkdir /home/user1/TST").. the comand executes but it is not creating a directory.
Please let me know how to go ahead in doing this activity via a script from server1.
Many Thanks
S.Jagadesh
I need to copy a file from server1:/tmp/test.tar to other servers(server2,3,4,5,6..:/home/user1/TST)directory.
The TST directory needs to be created before copying the file. I tried ssh from server1 (ssh server2 "mkdir /home/user1/TST").. the comand executes but it is not creating a directory.
Please let me know how to go ahead in doing this activity via a script from server1.
Many Thanks
S.Jagadesh
Solved! Go to Solution.
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-20-2005 11:46 AM
08-20-2005 11:46 AM
Solution
Hi Jagadesh ,
You can try the foloowing script running from server1.
#!/usr/bin/ksh
# copying server1:/tmp/test.tar to server2,3,4,5,6.. /home/user1/TST/
########################################
# Creating directory.
cd /tmp
for i in `cat server.list`
do
echo "Creating directory at server= $i"
ssh $i "mkdir /home/user1/TST"
done
# Copying file..
for i in `cat server.list`
do
scp /tmp/test.tar $i:/home/user1/TST
done
#######################################
Note: You need to provide the server's password while ssh/scp loggin in , if you donot have a ssh-keygen set from server1.
If ssh-keygen set from server1 , the script will prompt for password.
Cheers ,
Raj.D
You can try the foloowing script running from server1.
#!/usr/bin/ksh
# copying server1:/tmp/test.tar to server2,3,4,5,6.. /home/user1/TST/
########################################
# Creating directory.
cd /tmp
for i in `cat server.list`
do
echo "Creating directory at server= $i"
ssh $i "mkdir /home/user1/TST"
done
# Copying file..
for i in `cat server.list`
do
scp /tmp/test.tar $i:/home/user1/TST
done
#######################################
Note: You need to provide the server's password while ssh/scp loggin in , if you donot have a ssh-keygen set from server1.
If ssh-keygen set from server1 , the script will prompt for password.
Cheers ,
Raj.D
" If u think u can , If u think u cannot , - You are always Right . "
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-20-2005 11:56 AM
08-20-2005 11:56 AM
Re: need a script to copy a file to 5 servers
Hi ,
Pls put a echo $i , before scp , so that u can come to know which server password need to provide.
i.e
#!/usr/bin/ksh
# copying server1:/tmp/test.tar to server2,3,4,5,6.. /home/user1/TST/
########################################
# Creating directory.
cd /tmp
for i in `cat server.list`
do
echo "Creating directory at server= $i"
ssh $i "mkdir /home/user1/TST"
done
# Copying file..
for i in `cat server.list`
do
echo " Server = $i "
scp /tmp/test.tar $i:/home/user1/TST
done
#######################################
If ssh-keygen is set , it will not prompt for password.
Cheers,
Raj.D
Pls put a echo $i , before scp , so that u can come to know which server password need to provide.
i.e
#!/usr/bin/ksh
# copying server1:/tmp/test.tar to server2,3,4,5,6.. /home/user1/TST/
########################################
# Creating directory.
cd /tmp
for i in `cat server.list`
do
echo "Creating directory at server= $i"
ssh $i "mkdir /home/user1/TST"
done
# Copying file..
for i in `cat server.list`
do
echo " Server = $i "
scp /tmp/test.tar $i:/home/user1/TST
done
#######################################
If ssh-keygen is set , it will not prompt for password.
Cheers,
Raj.D
" If u think u can , If u think u cannot , - You are always Right . "
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-20-2005 11:58 AM
08-20-2005 11:58 AM
Re: need a script to copy a file to 5 servers
Also forgot to tell that server.list will have all the servers name .
like :
server2
server3
server4
------------
like :
server2
server3
server4
------------
" If u think u can , If u think u cannot , - You are always Right . "
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