Solved

Please check the script

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

Little introduction about CP: CP is a command on linux that use to copy files and folder from one location to another location. Example usage of CP as follow: cp /myfoder /pathto/destination/folder/ cp abc.tar.gz /pathto/destination/folder/ab…
Utilizing an array to gracefully append to a list of EmailAddresses
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

821 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