Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


Please check the script

Posted on 2014-01-23
Medium Priority
Last Modified: 2014-01-24
[root@central kdump_test]# cat initial_check3.sh
while read server
  echo -n $server
  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 ]"
    echo "[ done ]"
done < lnazvm_qacore

where lnazvm_qacore consist of server1.qua and server2.qua

Output is:

[root@central# kdump_test]# ./initial_check3.sh
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 ]
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 ]
Question by:oo_tatang
LVL 85

Expert Comment

ID: 39805649
Is that the result you expected?

Did you mean to use ' instead of "?
LVL 36

Accepted Solution

Seth Simmons earned 2000 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


Expert Comment

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

Featured Post

Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

Question has a verified solution.

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

The purpose of this article is to fix the unknown display problem in Linux Mint operating system. After installing the OS if you see Display monitor is not recognized then we can install "MESA" utilities to fix this problem or we can install additio…
It’s 2016. Password authentication should be dead — or at least close to dying. But, unfortunately, it has not traversed Quagga stage yet. Using password authentication is like laundering hotel guest linens with a washboard — it’s Passé.
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.:
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.
Suggested Courses
Course of the Month15 days, 9 hours left to enroll

581 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