Sponsored Content
Top Forums Shell Programming and Scripting Copy a file from local host to a list of remote hosts --- perl script Post 302801353 by siva kumar on Thursday 2nd of May 2013 12:40:18 AM
Old 05-02-2013
Copy a file from local host to a list of remote hosts --- perl script

Hi friends,

i need to prepare a script ( in perl)

i have a file called "demo.exe" in my local unix host.

i have a list of remote hosts in a file "hosts.txt"

now i need to push "demo.exe" file to all the hosts in "hosts.txt" file.

for this i need to prepare a script(in perl, but shell script also can be accepted), once i execute the script the "demo.txt" file should be copied to all the remote hosts in "hosts.txt" file.

i request all of you, please help me in this regard..

Thank you
 

10 More Discussions You Might Find Interesting

1. Solaris

How to delete the files from local host to remote host

Hi all, i am copying .gz files from production server to development server using "scp" command.my requirement is after copying .gz files i want to delete old .gz files(two days back) in development server from production server. like this way i need to delelte .log ,.z and .dmp files... (3 Replies)
Discussion started by: krishna176
3 Replies

2. UNIX for Advanced & Expert Users

Commands to copy a tar.gz file from a Remote Unix Server to Local Desktop.

Hi, Just wanted to know, how can I ftp/transfer/copy a (design.tar.gz) archive from a Unix Server (sdmc222.sdmc.cp-srv.com) which is at a remote location, to my Windows Desktop. Obviously, it is not possible at cmd prompt on my Windows using the following commands :- ftp... (3 Replies)
Discussion started by: marconi
3 Replies

3. UNIX for Dummies Questions & Answers

Copy files between remote hosts

Don't know if its correct to write into this topic but how can I copy files from a Windows machine to a UNIX system? (2 Replies)
Discussion started by: agasamapetilon
2 Replies

4. UNIX for Advanced & Expert Users

Help! How to find the local host after few ssh hops to remote host???

I do a ssh to remote host(A1) from local host(L1). I then ssh to another remote(A2) from A1. When I do a who -m from A2, I see the "connected from" as "A1". => who -m userid pts/2 2010-03-27 08:47 (A1) I want to identify who is the local host who initiated the connection to... (3 Replies)
Discussion started by: gomes1333
3 Replies

5. Shell Programming and Scripting

ssh to multiple hosts and saving the output in the local host

hi I have a script to login from a host "A" to a list of hosts in a file and perform some commands inside it...its somethin like this for i in `cat file` do ssh -t $i " command1 ; command2; ..." done I wanna save the outputs in a file in the current host "A" i.e from where I am... (3 Replies)
Discussion started by: ningy
3 Replies

6. UNIX for Dummies Questions & Answers

How to copy files from remote server to local?

Hi experts, I 'm newbie to unix world, now I have task to copy the latest files from remote server to my local. I believe this must be very common request in this community. I want you do it one more time for me please. My requirement is something like this: I receive files in the below... (3 Replies)
Discussion started by: parpaa
3 Replies

7. Shell Programming and Scripting

Copy from local to remote

Hi I need a advice for writing simple bash script, I have a file pod.txt which contains source location and remote location: /mnt/infile/20141103/701_0001.png/remote/tmp/pk21730/p0330223723074.png /mnt/infile/20141103/203_0001.png/remote/tmp/pk21731/p0330223723081.png and I must copy ... (6 Replies)
Discussion started by: primo102
6 Replies

8. Solaris

How to copy a tar file on a series of remote hosts and untar it on those hosts?

Am trying to copy a tar file onto a series of remote hosts and untar it at the destination. Need to do this without having to do multiple ssh. Actions to perform within a single ssh session via shell script - copy a file - untar at destination (remote host) OS : Linux RHEL6 (3 Replies)
Discussion started by: sankasu
3 Replies

9. Shell Programming and Scripting

Grep remote multiple hosts output to local server

Hello all, i'm trying to create a report by greping a pattern on multiple remote hosts and creta a simple report, actually i did this, is ther any better way to do this. #!/bin/bash for host in `cat RemoteHosts` do ssh $host -C 'hostname 2>&1; grep ERROR /var/log/WebServer.log.2019-09-21... (0 Replies)
Discussion started by: charli1
0 Replies

10. Shell Programming and Scripting

Copy local files to single remote host but multiple folders using rsync

I'm trying to copy a file myfile.scr from my local Linux server to multiple folders on remote AiX server using single rsync command. Below command helps me copy the file "myfile.scr" from my localhost to a remote host folder "/app/deployment/tmpfiles" rsync --delay-updates -F --compress... (1 Reply)
Discussion started by: mohtashims
1 Replies
MUSSH(1)							   MUltihost SSH							  MUSSH(1)

NAME
mussh - MUltihost SSH SYNOPSIS
mussh [ OPTIONS ] <-h host... | -H hostfile > [-c cmd ] [-C scriptfile ] DESCRIPTION
mussh is a shell script that allows you to execute a command or script over ssh(1) on multiple hosts with one command. When possible mussh will use ssh-agent(1) and RSA/DSA keys to minimize the need to enter your password more than once. OPTIONS
--help Prints full help text. -d Same as -d 1 -d 0 Turns debug mode off. -d 1 On STDERR prints out basic actions and ssh-agent activity and which host is being connected to. -d 2 Includes all of the output from -d1, the list of hosts, the command/script as it will be executed on each host, and a lot more. -v Same as -v 1 -v 1 Sets ssh in debug1 mode by passing "-v" to ssh. -v 2 Sets ssh in debug2 mode by passing "-v -v" to ssh. -v 3 Sets ssh in debug3 mode by passing "-v -v -v" to ssh. -m [n] Run concurrently on 'n' hosts at a time (asynchronous). Use '0' (zero) for infinite. (default) -q No output unless necessary. This will cancel -d and -v if after them on the command line. It also suppresses the output of each host. This will NOT suppress the password/passphrase prompts required to log into each host. -i <identity> [identity ..] Load an identity file. When -i is used, the specified identity file(s) is loaded instead of the default identity. You can load as many RSA/DSA identities as you'd like. -o <ssh-args> Args to pass to ssh with -o option. See the ssh(1) man page for more info on the -o option. -a Force loading ssh-agent. Without this flag, mussh will not load another agent when one is already loaded. -A Do NOT load ssh-agent. If no agent is loaded you will be prompted for a password or passphrase by ssh for each host. If you do not have RSA/DSA keys for the destination hosts, this will save you some hassle. -b Print each hosts' output in a block without mingling with other hosts' output. -B Allow hosts' output to mingle. (default) -u Unique. Eliminate duplicate hosts. (default) If you a host or user@host occurs more than once across files specified with -H or hosts specified with -h, the host or user@host is used only once. -U Do NOT make host list unique. This simply overrides the -u flag. This will cause scripts to be executed on duplicate hosts once per listing. -P Do NOT fall back to passwords on any host. This will skip hosts where keys fail. If you use this with '-d' you'll still see which hosts failed. -l <login> Use 'login' when no other is specified with hostname. -L <login> Force use of 'login' name on all hosts. These can be handy for adding 'root@' to hostnames kept in a file for -H option. With -h it means you get to type less. -s <shell> Path to shell on remote host. (Default: bash) -t <secs> Timeout setting for each session. (requires openssh 3.8 or newer) -V Print version info and exit. PROXY ARGS
-p [user@]<host> Host to use as proxy. (Must have mussh installed) -po <ssh-args> Args to pass to ssh on proxy with -o option. HOST ARGS
-h [user@]<host> [[user@]<host> ..] Add a host to list of hosts. May be used more than once. -H <file> [file ..] Add contents of file(s) to list of hosts. Files should have one host per line. Use "#" for comments. COMMAND ARGS
If neither is specified, commands will be read from standard input. -c <command> Add a command or quoted list of commands and args to list of commands to be executed on each host. May be used more than once. -C <file> [file ..] Add file contents to list of commands to be executed on each host. May be used more than once. PROXY MODE
When proxying, mussh can use a single remote server to as a bastion host. All hosts will be connected to from the central host rather than from the computer where you are initially running mussh. This can be handy when you only have access to one machine behind a firewall. The proxy host must have OpenSSH 2.3 or greater, or an sshd that works with ForwardAgent under ssh2. Proxy server must also have mussh installed in your PATH. To verify that it is in your path use "ssh user@proxy 'which mussh'". Use "ssh user@proxy 'echo $PATH'" to deter- mine what your path is. SSH-AGENT INTERACTION Assuming that you're not turning off the agent with '-A' mussh will attempt to use ssh-agent(1). Normally mussh will get rid of the agent when it exits. See EXAMPLES for examples. EXAMPLES
There is an EXAMPLES file with detailed examples. The basic command: $ mussh -h foo bar baz A simple command: $ mussh -h foo bar baz -c 'rpm -e emacs' A simple command asynchronously: $ mussh -h foo bar baz -c 'rpm -e emacs' -m Using a specific key: $ mussh -h foo bar baz -c 'rpm -e emacs' -i ~/.ssh/my_other.key Loading a list of hosts from a file: $ mussh -H /tmp/hostlist.txt -c 'rpm -e emacs' Loading a script from a file: $ mussh -h foo bar baz -C /tmp/scriptfile.sh BUGS
Please report any bugs at http://sourceforge.net/projects/mussh/ AUTHOR
Dave Fogarty <doughnut at doughnut dot net> SEE ALSO
ssh(1), ssh-agent(1) Doughnut August 2005 MUSSH(1)
All times are GMT -4. The time now is 08:35 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy