Solved

Please check the script

Posted on 2014-01-23
3
311 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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Linux users are sometimes dumbfounded by the severe lack of documentation on a topic. Sometimes, the documentation is copious, but other times, you end up with some obscure "it varies depending on your distribution" over and over when searching for …
The purpose of this article is to demonstrate how we can use conditional statements using Python.
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:

705 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now