Sponsored Content
Top Forums UNIX for Advanced & Expert Users Command to run across servers Post 302487502 by DGPickett on Thursday 13th of January 2011 01:55:17 PM
Old 01-13-2011
The ssh compression option is appropriate if the reports get long. It improves the security, too.

---------- Post updated 2011-01-13 at 01:55 PM ---------- Previous update was 2011-01-12 at 04:29 PM ----------

Quote:
Originally Posted by DGPickett
If you do not want nfs or remote scripts, you can ship the scripting from a central script:
Code:
 
while read host
do
 ( echo ". ./.profile
    -- all commands you want to run --
     " | ssh2 $host ksh >>log_dir/$host.$(date '+%Y''%m''%d-%H%M').log 2>&1
    if [ $? != 0 ]
    then
      echo "$host Down!"
    fi )&
done <host_list_file 2>&1 | cat -u

I prefer echo '...'"..."'...' | over <<!, keeping stuff flowing left to right, with switch to "..." where I want local interpretation, like $var, `` or $(), not piles of \escapes. Everything inside '...' is pretty stable and low cost for the shell to produce, so start there, go to "..." as necessary, and your life will have fewer unpleasant surprises.
Modified for parallel operarion. Logs were already separate for child reports. The "| cat" holds on until every subshell exits.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

I would like to know Would you run the ‘identd’ daemon on UNIX servers?

Would you run the ‘identd' daemon on UNIX servers? can you please Explain. thanks in advance! (3 Replies)
Discussion started by: xoxouu
3 Replies

2. Shell Programming and Scripting

ksh to run servers

I want to write a Kshell program which will start the servers(Oracle,DataIntegrator). Can anybody help me with this? I would appreciate your help. Thanks in advance (0 Replies)
Discussion started by: pari111222
0 Replies

3. Shell Programming and Scripting

How to run same script on multiples servers

Hi All, I have some script that run some commands and send results to my email. I want to run same script on mulitiple servers. How can I do that. I know there is an option "ssh". But I'm not quite sure how to use it in the script. And also. scripts has some parameters like following, if :... (10 Replies)
Discussion started by: s_linux
10 Replies

4. Shell Programming and Scripting

How do you guys run scripts against ALL your servers ?

I have 2000 odd servers (may of which are virtualisations) and if we want to run a script against all of them or distribute files/install software to all of them, we currently perform a simple for loop against a managed list of our servers called SLIST for host in `cat SLIST` ; do ssh $host... (1 Reply)
Discussion started by: rethink
1 Replies

5. Shell Programming and Scripting

Need a script to run on multiple mail servers..

Hello, I am a Unix newbie and I need a script in which I can run a command on multiple servers at work. The command is to start a storage process and I am sick of doing it manually on all servers.. Here's the command: /opt/bss/bin/snmptable -CB -v2c -c P67LzuBm hostname hrStorageTable... (4 Replies)
Discussion started by: kinyyy
4 Replies

6. Shell Programming and Scripting

Run a script in parts on 2 servers

Hi all, I have a task for which I need to run some commands on one server1 and then jump from the server1 (using ssh and asking user to enter login credentials manually for server2 server) to server2 and run some commands there and exit. I know the script I need here but problem is when I... (5 Replies)
Discussion started by: pat_pramod
5 Replies

7. Shell Programming and Scripting

Script for telnet and run one command kill it and run another command using while loop

( sleep 3 echo ${LOGIN} sleep 2 echo ${PSWD} sleep 2 while read line do echo "$line" PID=$? sleep 2 kill -9 $PID done < temp sleep 5 echo "exit" ) | telnet ${HOST} while is executing only command and exits. (5 Replies)
Discussion started by: sooda
5 Replies

8. Shell Programming and Scripting

Run a script on multiple servers

I need to run a script on a bunch of remote servers. how can this be done without ssh into each individual server and run it its under /sbin/script.sh on each server (1 Reply)
Discussion started by: tdubb123
1 Replies

9. Shell Programming and Scripting

Run a shell script on all 15 servers at the same time?

We have 15 servers. Hostnames for these 15 servers are stored in a text files and loop through each server to connect to the remote server and run a command, but this loop process runs the command one after another. However, the requirement is to run the same command on all 15 servers at the same... (10 Replies)
Discussion started by: laknar
10 Replies

10. Shell Programming and Scripting

How to run simple single command on multiple Linux servers?

Hi All, How can i run a single command on multiple servers with or without giving credentials. I have a file(servers.txt) which has got list of servers and i want to run a command lsb_release -dr on all these servers and get output of those servers against each server. I tried below code... (9 Replies)
Discussion started by: darling
9 Replies
bprelay(8)						      System Manager's Manual							bprelay(8)

NAME
bprelay - BOOTP relay agent SYNOPSIS
/usr/sbin/bprelay [-f] [-d n] [-h hopcount] [-i interface,interface...] [-t minutes] [-w seconds] server... OPTIONS
Foreground mode. In this mode, bprelay does not run as a daemon. All messages are written to stdout and stderr, although warnings and errors are still sent to syslog(3). Without this option, bprelay listens on all interfaces on which the underlying protocol supports broadcasting. With this option, bprelay listens only to those interfaces specified. Any non-existent or invalid interface name are ignored. Sets debug level to the numeric value n. Larger values of n provides more debugging information. Instructs bprelay to not for- ward packets if the value of the hops field in the BOOTP packet exceeds hopcount. Instructs bprelay to terminate if minutes have passed without any packets being received. This option is only honored if bprelay was started from inetd(8). Instructs bprelay to not forward packets until the secs field in the BOOTP packet header exceeds this value. DESCRIPTION
The bprelay daemon forwards DHCP or BOOTP packets to the specified list of servers (server). Servers may be identified either by their IP addresses or by their names. The bprelay agent normally runs as a daemon process, and may be started either from the shell command line interface or by inetd(8). The purpose of bprelay is to provide the same service as that found in router hardware, but to run on UNIX workstations. The bprelay agent listens for DHCP/BOOTP packets on each of the interfaces specified in the command line, and relays each packet to the servers specified. As a rule, bprelay forwards each and every packet to every server specified, but it omits servers whose IP address is found to be on the same IP network as the receiving interface since those servers will presumably hear the original broadcast. RESTRICTIONS
Non-standard subnet masks for all networks administered by bprelay, must be available either through /etc/netmasks or NIS. SEE ALSO
Commands: inetd(8), joinc(8) System calls: syslog(3) RFC1497, RFC1542, RFC1534 bprelay(8)
All times are GMT -4. The time now is 03:41 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy