Solved

Please check the script

Posted on 2014-01-23
3
316 Views
Last Modified: 2014-01-24
[root@central kdump_test]# cat initial_check3.sh
#!/bin/bash
while read server
do
  echo -n $server
  echo
  ssh -n root@$server "cat /boot/config-`uname -r`|grep -e KEXEC -e CRASH"
 ssh -n root@$server "cat /boot/config-`uname -r`"
  if [ $? -ne 0 ]; then
    echo "[ FAIL ]"
  else
    echo "[ done ]"
  fi
done < lnazvm_qacore

where lnazvm_qacore consist of server1.qua and server2.qua


Output is:


[root@central# kdump_test]# ./initial_check3.sh
server1.qua
cat: /boot/config-2.6.18-128.el5: No such file or directory
cat: /boot/config-2.6.18-128.el5: No such file or directory
[ FAIL ]
server2.qua
cat: /boot/config-2.6.18-128.el5: No such file or directory
cat: /boot/config-2.6.18-128.el5: No such file or directory
[ FAIL ]
0
Comment
Question by:oo_tatang
3 Comments
 
LVL 84

Expert Comment

by:ozo
ID: 39805649
Is that the result you expected?

Did you mean to use ' instead of "?
0
 
LVL 34

Accepted Solution

by:
Seth Simmons earned 500 total points
ID: 39805663
the problem is your uname command
with backtick, it's executed first and placed in that command

this means uname -r is executed locally and 2.6.18-128.el5 (your local kernel) is placed there and that kernel is not on the remote system

replace the " with ' only and the command in () and that should run uname on the remote system

ssh -n root@$server '(cat /boot/config-`uname -r`|grep -e KEXEC -e CRASH)'

Open in new window

0
 
LVL 8

Expert Comment

by:Surrano
ID: 39805913
You don't even need the parentheses.
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Have you ever been frustrated by having to click seven times in order to retrieve a small bit of information from the web, always the same seven clicks, scrolling down and down until you reach your target? When you know the benefits of the command l…
Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question