Dennis,<br><br>I posted this last week, but here it is again. This is the script I run (simplified) on each RHEL version that gets its version number and then subscribes it to the correct Satellite channel using activation keys:<br>
<br><br>Also, fyi I scripted the entire registration process including creation of my ssl cert for my local satellite:<br>
<br><br>(I simplified it to the below for the this thread)<br><br>#!/bin/bash<br><br><br>### Variables -> Need to be updated for rhel 3 servers ( ) and rhel 4 servers ()<br>RHEL3_VER=`cat /etc/redhat-release | awk '{print $7}'`<br>
RHEL3_Point=`cat /etc/redhat-release | awk '{print $10}' | cut -c 1`<br><br><br>RHEL_VER=$RHEL3_VER$RHEL3_Point<br>ARCH=`uname -a | awk '{ print $12 }'`<br><br>cp /etc/sysconfig/rhn/up2date /etc/sysconfig/rhn/up2date.bk<br>
cp /usr/share/rhn/RHN-ORG-TRUSTED-SSL-CERT /usr/share/rhn/RHN-ORG-TRUSTED-SSL-CERT.bk<br><br>## Remove old <a target="_blank" href="http://rhn.redhat.com/">rhn.redhat.com</a> entry if it exists<br>perl -npe 's/RHNS-CA-CERT/RHN-ORG-TRUSTED-SSL-CERT/g' -i /etc/sysconfig/rhn/*<br>
perl -npe 's/<a target="_blank" href="http://xmlrpc.rhn.redhat.com/mysatellite.my.domain/">xmlrpc.rhn.redhat.com/mysatellite.my.domain/</a>' -i /etc/sysconfig/rhn/up2date<br><br>## Insert correct SSL Cert and GPG Key<br>
<br>cat > /tmp/gpg-key-1 <<'EOF'<br>
-----BEGIN PGP PUBLIC KEY BLOCK-----<br>xxxxxxxxxxxxxxxxxxx<br>-----END PGP PUBLIC KEY BLOCK-----<br><br>EOF<br># gpg-key1<br>rpm --import /tmp/gpg-key-1<br><br><br><br>cat > /tmp/ssl-key-1 <<'EOF'<br>Certificate:<br>
xxxxxxxxxxxxxxxxxxxxx<br>
-----END CERTIFICATE-----<br>EOF<br># ssl-key1<br>cat /tmp/ssl-key-1 > /usr/share/rhn/RHN-ORG-TRUSTED-SSL-CERT<br><br><br><br>if [ $RHEL_VER = 38 -a $ARCH = i686 ]<br>then<br> rhnreg_ks --activationkey=1-xxx --force<br>
service rhnsd stop<br> chkconfig rhnsd off<br>fi<br><br><br>if [ $RHEL_VER = 45 -a $ARCH = x86_64 ]<br>then<br> rhnreg_ks --activationkey=1-xxx --force<br>
service rhnsd stop<br> chkconfig rhnsd off<br>fi<br><br><br>if [ $RHEL_VER = 46 -a $ARCH = i686 ]<br>then<br> rhnreg_ks --activationkey=1-xxx --force<br>
service rhnsd stop<br> chkconfig rhnsd off<br>fi<br><br><br>if [ $RHEL_VER = 46 -a $ARCH = x86_64 ]<br>then<br> rhnreg_ks --activationkey=1-xxx --force<br>
service rhnsd stop<br> chkconfig rhnsd off<br>fi<br><br>if [ $RHEL_VER = 48 -a $ARCH = i686 ]<br>then<br> rhnreg_ks --activationkey=1-xxx --force<br> service rhnsd stop<br>
chkconfig rhnsd off<br>fi<br><br>if [ $RHEL_VER = 48 -a $ARCH = x86_64 ]<br>then<br> rhnreg_ks --activationkey=1-xxx --force<br> service rhnsd stop<br>
chkconfig rhnsd off<br>fi<br><br>if [ $RHEL_VER = 5.3 -a $ARCH = x86_64 ]<br>then<br> service yum-updatesd stop<br> chkconfig yum-updatesd off<br> rhnreg_ks --activationkey=1-xxx --force<br>
<br>fi<br><br>if [ $RHEL_VER = 5.4 -a $ARCH = x86_64 ]<br>then<br> <br> service yum-updatesd stop<br> chkconfig yum-updatesd off<br>
rhnreg_ks --activationkey=1-xxx --force<br> <br>fi<br><br>if [ $RHEL_VER = 5.4 -a $ARCH = i686 ]<br>then<br> service yum-updatesd stop<br> chkconfig yum-updatesd off<br>
rhnreg_ks --activationkey=1-xxx --force<br> <br>fi<br><br>if [ $RHEL_VER = 5.6 -a $ARCH = x86_64 ]<br>then<br> service yum-updatesd stop<br> chkconfig yum-updatesd off<br>
rhnreg_ks --activationkey=1-xxx --force<br> <br>fi<br><br>if [ $RHEL_VER = 5.6 -a $ARCH = i686 ]<br>then<br> service yum-updatesd stop<br> chkconfig yum-updatesd off<br>
rhnreg_ks --activationkey=1-xxx --force<br> <br>fi<br><br>if [ $RHEL_VER = 6 -a $ARCH = x86_64 ]<br>then<br> service yum-updatesd stop<br> chkconfig yum-updatesd off<br>
rhnreg_ks --activationkey=1-xxx --force<br> <br>fi<br><br><br><br><div class="gmail_quote">On Mon, Aug 1, 2011 at 11:17 AM, Dennis Ruzeski <span dir="ltr"><<a href="mailto:denniruz@gmail.com">denniruz@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">Something like this?<br>
<br>
cat /etc/redhat-release |awk '/release/ { for (x=1;x<=NF;x++) if<br>
($x~"release") print $(x+1) }'<br>
<font color="#888888"><br>
--Dennis<br>
</font><div><div></div><div class="h5"><br>
<br>
<br>
On Mon, Aug 1, 2011 at 10:52 AM, Chuck Payne <<a href="mailto:terrorpup@gmail.com">terrorpup@gmail.com</a>> wrote:<br>
> Guys,<br>
><br>
> I am working on adding servers to my Satellite server, and I like to<br>
> be able to get in with a script and call on the following<br>
><br>
> /etc/redhat_release<br>
><br>
> But I only want to get the number, so that I can see if it RHEL 4 or<br>
> 5, I been trying to do with awk, but I am not able to get anything,<br>
> what is the best way to only put numbers?<br>
><br>
> --<br>
> <a href="tel:%28678%29%20636-9678" value="+16786369678">(678) 636-9678</a><br>
> -----------------------------------------<br>
> Discover it! Enjoy it! Share it! openSUSE Linux.<br>
> -----------------------------------------<br>
> openSUSE -- <a href="http://en.opensuse.org/User:Terrorpup" target="_blank">en.opensuse.org/User:Terrorpup</a><br>
> openSUSE Ambassador/openSUSE Member<br>
> skype,twiiter,identica,friendfeed -- terrorpup<br>
> freenode(irc) --terrorpup/lupinstein<br>
> Register Linux Userid: 155363<br>
><br>
> Have you tried SUSE Studio? Need to create a Live CD, an app you want<br>
> to package and distribute , or create your own linux distro. Give SUSE<br>
> Studio a try. <a href="http://www.susestudio.com" target="_blank">www.susestudio.com</a>.<br>
><br>
> _______________________________________________<br>
> Ale mailing list<br>
> <a href="mailto:Ale@ale.org">Ale@ale.org</a><br>
> <a href="http://mail.ale.org/mailman/listinfo/ale" target="_blank">http://mail.ale.org/mailman/listinfo/ale</a><br>
> See JOBS, ANNOUNCE and SCHOOLS lists at<br>
> <a href="http://mail.ale.org/mailman/listinfo" target="_blank">http://mail.ale.org/mailman/listinfo</a><br>
><br>
<br>
_______________________________________________<br>
Ale mailing list<br>
<a href="mailto:Ale@ale.org">Ale@ale.org</a><br>
<a href="http://mail.ale.org/mailman/listinfo/ale" target="_blank">http://mail.ale.org/mailman/listinfo/ale</a><br>
See JOBS, ANNOUNCE and SCHOOLS lists at<br>
<a href="http://mail.ale.org/mailman/listinfo" target="_blank">http://mail.ale.org/mailman/listinfo</a><br>
</div></div></blockquote></div><br>