Sponsored Content
Top Forums Shell Programming and Scripting Running set of commands in remote servers in shell script Post 302920992 by kumaraswamy on Tuesday 14th of October 2014 05:40:44 AM
Old 10-14-2014
Hi Rudic,
Actually, i am able to prepare the scripts separatly ...for ping status ans ssh status ...

Code:
while read line
do
        ping -c 1 $line > /dev/null 2> /dev/null
        if [ $? -eq 0 ];then
                echo "$line is up"
        else
                echo "$line is down"
        fi
done < servers.txt


Code:
while read line
do
     ssh "$line" "uname -a; w|wc -l " < /dev/null
done < servers.txt

the above ssh script...if any server is not up, then the script is not moving further server...

mainly , i need the out put as i mentioned in the first post...

Thanks
kumaraswamy

Last edited by rbatte1; 10-14-2014 at 07:29 AM.. Reason: Changed ICODE to CODE
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

unix shell script which inserts some records into a file located in remote servers...

All, I need to write an unix shell script which inserts some records into a file located in remote servers. * Get the input from the user and insert according the first row. It should be in ascending order. 123451,XA,ABA 123452,XB,ABB 123453,XC,ABC 123455,XE,ABE 123456,XF,ABF 123458,XG,ABG... (2 Replies)
Discussion started by: techychap
2 Replies

2. UNIX for Dummies Questions & Answers

Running the same remote script on multiple servers

Experts, Im trying to remote into a server, run a script that resides on that server and capture the information displayed & store in a local file. I struggled with this yesterday & finally that script is working now. Now, here is a scope creep and the script that I wrote for 1 remote... (2 Replies)
Discussion started by: OMLEELA
2 Replies

3. Shell Programming and Scripting

Prevent wrong user from using shell script for multiple remote servers

Hi, I am running a shell script from a central server to multiple remote servers using the following code: application_check() { # Linux/UNIX box with ssh key based login SERVERS=`cat /tmp/server-details` # SSH User name USR="user" # create new file > /tmp/abc.log # connect... (2 Replies)
Discussion started by: mystition
2 Replies

4. Shell Programming and Scripting

Shell script with mutiple steps/commands, on UNIX servers

Hi, I wrote a simple script, which will call other scripts or run commands on a UNIX server. my script has multiple steps/commands with some delay in between. I usually get some email notifications after the successful execution of each step. **My intention is to get email alerts when it is... (5 Replies)
Discussion started by: System Admin 77
5 Replies

5. Shell Programming and Scripting

Shell script help to execute ssh remote commands

Hi, The below command is not giving me the count , Can somebody help me in re-writing this pls . Proc_Exist=`ssh -q -o "BatchMode=yes" -o "PasswordAuthentication=no" $OAUSER@${Primary_Node} ps -ef | grep -v grep | grep "${ICM_Proc}" |wc -l ` Also the same problem with below... (13 Replies)
Discussion started by: Y.balakrishna
13 Replies

6. Shell Programming and Scripting

Issue with running commands from shell script

I'm trying to copy files from a remote windows server to Unix server. I was successfully able to copy files from windows server using command prompt but when I run these commands from a script it's not working as expected. commands used: sftp user@remoteserver.com lcd local_dir cd... (3 Replies)
Discussion started by: naresh7590
3 Replies

7. Shell Programming and Scripting

Remote login and running a script on multiple servers

Hi all, I am baffled on this. Solaris Irix system.:confused: I have 4 servers all connected to one another, :b: I need to write a script line that would login on to server 1-3 ($HOST) start a script in the back ground and log off while the back ground script runs over a length of time.:eek: ... (10 Replies)
Discussion started by: weddy
10 Replies

8. Shell Programming and Scripting

Shell script to set user password to never expire in UNIX servers

Hi, I have a requirement where in i need to write a shell script to set users password to never expire. I know the command which is used to perform the same .. which is chage command. But, could not figure out how to do the same in shell script. Could you please help me with the shell... (3 Replies)
Discussion started by: suren424
3 Replies

9. Shell Programming and Scripting

Shell script for remote servers

Hi , I have written a small script : set -x #!/bin/ksh for i in `cat /tmp/list` ( list contains remove servers ) do ssh -t $i << EOF uname -a cd ~user echo "Enter the dir >" read dir path=`ll -ld /home/user/"$dir"` if ; then echo "Dir exists " read rm $path else echo "no such... (9 Replies)
Discussion started by: kpatel786
9 Replies

10. Shell Programming and Scripting

Error running grep on Remote Servers

Im running the below command sshpass -p mypassword ssh -t user1@server2 /bin/bash -c 'echo "mypassword" | sudo -S -l; echo "$?#`grep -iE "user66|dbuser|tomcat|splunk|stash|jira|user2|docadmin" /etc/passwd`"; exit' Below is the error I get: Output: I run this command across a... (1 Reply)
Discussion started by: mohtashims
1 Replies
Xsession.options(5)						File Formats Manual					       Xsession.options(5)

NAME
Xsession.options - configuration options for Xsession(5) DESCRIPTION
/etc/X11/Xsession.options contains a set of flags that determine some of the behavior of the Xsession(5) Bourne shell (sh(1)) script. See the Xsession(5) manpage for further information. Xsession.options may contain comments, which begin with a hash mark ('#') and end at the next newline, just like comments in shell scripts. The rest of the file consists of options which are expressed as words separated by hyphens, with only one option per line. Options are enabled by simply placing them in the file; they are disabled by prefixing the option name with 'no-'. Available options are: allow-failsafe If the 'failsafe' argument is passed to the Xsession script, an emergency X session is invoked, consisting of only an x-termi- nal-emulator(1) in the upper-left hand corner of the screen. No window manager is started. If an x-terminal-emulator program is not available, the session exits immediately. allow-user-resources If users have a file called .Xresources in their home directories, these resources will be merged with the default X resources when they log in. allow-user-xsession If users have an executable file called .xsession in their home directories, it can be used as the startup program for the X session (see Xsession(5)). If the file is present but not executable, it may still be used, but is assumed to be a Bourne shell script, and executed with sh(1). use-session-dbus If the dbus package is installed, the session bus will be activated at X session launch. use-ssh-agent If the ssh-agent(1) program is available and no agent process appears to be running already, the X session will be invoked by exec'ing ssh-agent with the startup command, instead of the startup command directly. All of the above options are enabled by default. Additional options may be supported by the local administrator. Xsession(5) describes how this is accomplished. AUTHORS
Stephen Early, Mark Eichin, and Branden Robinson developed Debian's X session handling scripts. Branden Robinson wrote this manual page. SEE ALSO
Xsession(5), ssh-agent(1), x-terminal-emulator(1) Debian Project 2004-10-31 Xsession.options(5)
All times are GMT -4. The time now is 04:48 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy