Sponsored Content
Top Forums Shell Programming and Scripting Script to execute command to get info from multiple servers Post 302718209 by jim mcnamara on Friday 19th of October 2012 10:11:20 AM
Old 10-19-2012
Create a list of servers, call it servers.dat
Code:
> ./present
> ./not-present
while read node
do
      ssh $node 'sudo  grep -q  "elevator=noop" /etc/grub.conf'
      if [ $? -eq 0 ] ; then
         echo "$node" >> ./present
      else
         echo "$node" >> ./not-present
      fi
done < servers.dat

This requires that your account be set up to sudo on all of the servers, and that you have set up ssh-keys (from the box where you execute the above script) for your account on all servers in the respective ~/.ssh/authorized_keys files.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

login into multiple servers thru script...

I need to login into multiple servers thru a script run couple commands and run find command as root. I only have ssh access to the servers as a user than I can "su" to root. If you have a similar script please post it. Also if you can suggest commands that I should consider please let me know. ... (1 Reply)
Discussion started by: avcert1998
1 Replies

2. Shell Programming and Scripting

Script ftp multiple servers

Hi guys , i have 1 problem and no find what is the problem...:confused:, and .netrc is configured and correct permissions... REMOTE="/home/user" LISTADO=`cat /root/home/user/LISTADO.txt` MACHINE=$(echo $i|awk 'FS="|" {print $1}') for i in $LISTADO do ftp $MACHINE <<TER passive prompt... (2 Replies)
Discussion started by: Esquizo000
2 Replies

3. Shell Programming and Scripting

connect to multiple servers using SSH and execute commands

Requirement: Run a shell script with below inputs file name checksum path the script should go to multiple servers (around 35) and verify the input cksum and if there is a mismatch display a simple message to the user that cksum verification failed. host details, user id /... (1 Reply)
Discussion started by: amicableperson
1 Replies

4. Shell Programming and Scripting

bash script to execute a command remote servers using ssh

Hello, I am running into few issues, please suggest me what I am missing. I am running this script on a linux host. Main idea of this script is to, login to each host via ssh and get uid of user, service user that I trying to run this script, has already deployed ssh keys and provide sudo... (8 Replies)
Discussion started by: bobby320
8 Replies

5. Shell Programming and Scripting

Script for login to servers with user name and password and execute commands

I am having the 15 servers which need to do the monitoring Hi I need a shell script, By which i can log in to multiple servers and execute the commands.. I need to specify the username and password in the scripts. Please help me to write the script so that it can login with username and... (5 Replies)
Discussion started by: nandan8a
5 Replies

6. Shell Programming and Scripting

Require single command to start script in multiple servers

I have 9 servers, on each server a script with common name is available. I send a token file to all server from 1 particular server. so when a daemon job checks that token file is available then it triggers the script.. I want to know is there any command or script which I will run/execute on... (16 Replies)
Discussion started by: mirwasim
16 Replies

7. Shell Programming and Scripting

Logging in to multiple Linux servers and running the command.

Hi, I am trying to write a script to run a command on multiple linux based servers and get the o/p. I am using ssh to login. It is a celerra box and EMC NAS product. I am able login but i am not able to run nas command nas_pool -size -all the NAS server. I am getting the following error. ... (2 Replies)
Discussion started by: jpkumar10
2 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

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

10. UNIX for Beginners Questions & Answers

One Line Command how to use pipe statements to execute and comment on multiple possible outcomes

Hello Forum, I'm looking to expand the following command: INACTIVE_KERNELS=$(python -mplatform | grep -qi red && rpm -qa | grep '^kernel-' |grep -vE `uname -r` | paste -sd \; || echo "Not Red Hat Server") Currently this command will check if my server is RedHat server using the grep -qi... (6 Replies)
Discussion started by: greavette
6 Replies
GRUB(8) 								FSF								   GRUB(8)

NAME
grub - the grub shell SYNOPSIS
grub [OPTION]... DESCRIPTION
Enter the GRand Unified Bootloader command shell. --batch turn on batch mode for non-interactive use --boot-drive=DRIVE specify stage2 boot_drive [default=0x0] --config-file=FILE specify stage2 config_file [default=/boot/grub/grub.conf] --device-map=FILE use the device map file FILE --help display this message and exit --hold wait until a debugger will attach --install-partition=PAR specify stage2 install_partition [default=0x20000] --no-config-file do not use the config file --no-curses do not use curses --no-floppy do not probe any floppy drive --no-pager do not use internal pager --preset-menu use the preset menu --probe-second-floppy probe the second floppy drive --read-only do not write anything to devices --verbose print verbose messages --version print version information and exit REPORTING BUGS
Report bugs to <bug-grub@gnu.org>. SEE ALSO
The full documentation for grub is maintained as a Texinfo manual. If the info and grub programs are properly installed at your site, the command info grub should give you access to the complete manual. grub (GNU GRUB 0.93) December 2002 GRUB(8)
All times are GMT -4. The time now is 03:19 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy