Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Bash - here document on RHEL 6.8 and 6.9 servers aren't working Post 303040553 by greavette on Thursday 31st of October 2019 11:50:49 AM
Old 10-31-2019
Bash - here document on RHEL 6.8 and 6.9 servers aren't working

H Forum,

I was thankful in getting help from this post that allowed me to connect to multiple severs at once using here documents to gather data into variables. But I've discovered that the same bash command that works on my RHEL 7 servers do not work on RHEL 6? What's strange about my problem is that I'm not getting an error either. The problem is that the variables return empty when I try the following code on RHEL 6.8 or 6.9 servers we manage:

Code:
IFS=$'\t' read FLAVOUR HOSTNAME ACTIVE_KERNEL INACTIVE_KERNEL UPTIME <<- EOFREAD
        $ssh -qo StrictHostKeyChecking=no -o ConnectTimeout=1 user@$InputIP sudo -u user sh -s <<- EOFSSH | tr $'\n' $'\t'
        exec bash
        cat /etc/redhat-release 2>/dev/null || lsb_release -a 2>/dev/null | grep Description | cut -f2
        awk -F= '/^NAME/{print $2}' /etc/os-release 2>/dev/null || grep Red |cat /etc/redhat-release 2>/dev/null || lsb_release -a 2>/dev/null | grep Description | cut -f2
        hostname
        uname -r
        rpm -qa | grep '^kernel-[0-9]' |grep -vE `uname -r` | paste -sd \; || echo "Can't List Ubuntu Kernels"
        uptime | cut -d "," -f1
        exit
EOFSSH
        )
EOFREAD

I've thought of adding in the ability to determine if my server is RHEL 6 or 7 using code like the following:

python -mplatform | grep -qi red &&

but even if I could determine RHEL version I'm still not sure why my RHEL 6 servers do not return variable data back. I've tested this above code connecting to just one server to try and triage the issue. No errors are returned. the variable fields are just empty. Whereas on my RHEL 7 servers I return back variables with no issue. Could it be that how I use Here Documents just doesn't work with RHEL 6 servers? has anyone seen this before?

I've also tested connecting to a RHEL 6 server multiple times to get the data I need. what I mean by this is instead of connecting to a RHEL 6 server once and collecting data I've tested connecting to a RHEL 6 for each command I need so connecting multiple times and there are no issues with the above commands I'm issuing.

Perhaps I'll just need to identify RHEL 6 servers and gather their data differently than I do for RHEL 7 severs but before I do that I thought I would check this forum for any advice first.

Thank you.
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

here document not working

I tried doing ftp myhost <<HERE username password quit HERE but it doesnt work. Why? When I do ftp host, I always get prompted for username, and once I type that in I get prompted for password. But when I try doing it from here document it freezes. (2 Replies)
Discussion started by: JamesByars
2 Replies

2. Red Hat

Who can give me a document for configure nagios on RHEL 5

Who can give me a document for configure nagios on RHEL 5,thanks . (1 Reply)
Discussion started by: zhengsenlin
1 Replies

3. Red Hat

cfengine / puppet for rhel servers

Hello all, I am planning to deploy a configuration / auditing software package for about 100 new nodes that we are planning to install. I am hearing many good things in regards to cfengine and puppet. Can someone shed some light in regards to these solutions? Thanks, jaysunn (1 Reply)
Discussion started by: jaysunn
1 Replies

4. Shell Programming and Scripting

sudo inside a here document not working

Have a sudo statement inside of a here document. It prompts me for a password, but doesnt wait for me to enter my password. Is there a way I can use the command without sudo or anyway that I can enter the password correctly? Eg : while read remotehost do ssh -t $2@$remotehost <<REMOTE... (13 Replies)
Discussion started by: mnanavati
13 Replies

5. Shell Programming and Scripting

RHEL - Shell Script not working

Hello Unix Mates I have a problem my script is not working, can anyone tell what is rung with it? #!/bin/sh wget "http://download.divx.com/labs/divx611-20060201-gcc4.0.1.tar.gz" tar zxf divx611-20060201-gcc4.0.1.tar.gz ./divx611-20060201-gcc4.0.1/install.shError: -2010-11-28 21:25:06-- ... (1 Reply)
Discussion started by: camper
1 Replies

6. Red Hat

RHEL 6 plain telnet & ftp servers

I am being pushed from AIX onto RHEL 6 and after our first 'chuck it on' install, I have a problem. Where is the old (okay insecure) telnet & ftp server? I know that they are probably regarded as archaic now, but the source servers do not have the SSH tools, so I've got to somehow transfer the... (4 Replies)
Discussion started by: rbatte1
4 Replies

7. Red Hat

Network Teaming not working in RHEL/CentOS 7

I was testing Networking Teaming (activebackup) with a VM hosted on VmWare Workstation and VirtualBox, and the result is, if the active interface is down, the system is not using the backup interface. Tested on both CentOS / RHEL 7 Please find below the command I have used to configure teaming.... (0 Replies)
Discussion started by: atanubanerji
0 Replies

8. Red Hat

RHEL 7.1 autofs permissions do not match NFS servers

RHEL 7.1 client using autofs to mount a NIS map of home directories being exported by a Solaris 10x86 nfs server. The owner and group are correct on the NFS server, but on the RHEL client, the owner and group end up being nobody nobody. The USERS and GROUPS are NIS maps as well. They are... (2 Replies)
Discussion started by: mrmurdock
2 Replies

9. UNIX for Advanced & Expert Users

Syslog-ng not working not collecting logs on rhel

Hi, I need help on syslog-ng on RHEL 7.2. It is working as expected. As per configuration, it is supposed to create authlog, messages and xymessages daily in respective folder of date. But I can see only messages file and that is also not updating well. # ps -ef | grep -i syslog root 22954... (1 Reply)
Discussion started by: solaris_1977
1 Replies
yum-verify(1)															     yum-verify(1)

NAME
yum verify plugin SYNOPSIS
yum [options] verify [package ...] DESCRIPTION
This plugin extends yum with some commands that give verification information on the installed system, much like rpm -V. You can change how the verification is done and which files it applies to. added yum commands are: * verify * verify-rpm * verify-all all of which take the same arguments as the list yum command, obviously you can only verify packages that are installed on the system. verify Is the generic verification command, and is intended to give the most useful output. It removes all false matches due to multilib and ignores changes to configuration files by default. verify-rpm Is meant to be 100% compatible with rpm -V output, and any differences should be considered as bugs. verify-all Is used to list all the differences, including some that rpm itself will ignore. GENERAL OPTIONS
These are the options added to yum that are available in the verify commands. They are: --verify-filenames This option is used to limit the filenames that the packages will perform verification. --verify-configuration-files This option is only useful in the generic verify command, and will enable/disable verification of files that are tagged as configu- ration files. EXAMPLES
To do the same as rpm -Va, use: yum verify-rpm To verify the packages starting with the name yum, use: yum verify 'yum*' To verify the binaries that are in a bin directory, use: yum verify --verify-filenames='*bin/*' To verify all include files, Eg. for multilib problems, use: yum verify-all --verify-filenames='/usr/include/*' SEE ALSO
yum (8) yum.conf (5) the verify.conf file in /etc/yum/plugins.d AUTHORS
James Antill <james.antill@redhat.com>. BUGS
Currently yum-verify does not do verify-script checking or dependency checking, only file checking. Should you find any other bugs, you should first consult the FAQ section on http://yum.baseurl.org/wiki/Faq and if unsuccessful in finding a resolution contact the mailing list: yum-devel@lists.baseurl.org. To file a bug use http://bugzilla.redhat.com for Fedora/RHEL/Centos related bugs and http://yum.baseurl.org/report for all other bugs. James Antill 01 March 2008 yum-verify(1)
All times are GMT -4. The time now is 12:31 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy