Wednesday, July 13, 2011

Yum groups and repositories

Yum supports the group commands
  • grouplist
  • groupinfo
  • groupinstall
  • groupremove
  • groupupdate
Groups are read from the "group" xml metadata that is optionally available from each repository. If yum has no repositories which support groups then none of the group operations will work.
  • grouplist
    yum grouplist [hidden]
    
This will list the installed and available groups for your system in two separate lists. If you pass the optional 'hidden' argument then all of the groups which are set to 'no' in the group xml tag.
  • groupinfo
    yum groupinfo groupname
    
This will give you detailed information for each group including: description, mandatory, default and optional packages.
  • groupinstall, groupupdate
    yum groupinstall groupname
         yum groupupdate groupname
    
Despite their differing names both of these commands perform the same function. They will attempt to install/update all of the packages in the group that are of the types 'default' or 'mandatory' (by default). (To change this types of packages edit the value of the group_package_types option in yum.conf.) And they will install any additional dependencies needed by any of the installing/updating packages.
  • groupremove
    yum groupremove groupname
    
This will remove all packages, of any type, in the named group. It will also remove any package that depends on any of these packages.

Thursday, June 30, 2011

Using grep to extract specific FIX protocol tags values from a file

grep -o -w '\(48\|55\)=[^[:cntrl:]]\+' FILE | perl -pe 's/(\d+=[^\n]+)\n/\1~/' | perl -pe 's/([^~]+~[^~]+)~/\1\n/g'

grep -o -w '\(48\|55\)=[^[:cntrl:]]\+' FILE | tr '\n' '~' | perl -pe 's/([^~]+~[^~]+)~/\1\n/g'

grep -o -w '\(48\|55\)=[^[:cntrl:]]\+' FILE | sed 'N;s/\n/ /'

-o Print only the matched parts of a matching line
-w Select lines containing matches that form whole words (a whole char is a letter, digit and underscore)

Tuesday, June 28, 2011

Static routes after restart/reboot in Fedora/RedHat/CentOS

Static routing is the term used to refer to the manual method used to set up routing. An administrator enters routes into the router using configuration commands. This method has the advantage of being predictable, and simple to set up. It is easy to manage in small networks but does not scale well.

Question: How can I save static routes I set up in my Fedora/RedHat/CentOS Linux after I reboot server?

Answer: In Fedora Linux (or RedHat, CentOS) you can set up static routes for certain network interface (for example eth1) by editing file /etc/sysconfig/network-scripts/route-eth1.

For example, you have to save static route added by the following command:

route add -net 192.168.0.0 netmask 255.255.255.0 gw 192.168.100.1 dev eth1

To do it, just add the following line to /etc/sysconfig/network-scripts/route-eth1:

ADDRESS0=192.168.0.0
NETMASK0=255.255.255.0
GATEWAY0=192.168.100.1

The alternate way of doing it is to put the routes in /etc/sysconfig/static-routes. So the above route would like this like in the static-routes file:

any net 192.168.0.0 netmask 255.255.255.0 gw 192.168.100.1

Where any is specified above you can also set specific interfaces (such as eth1).

Here is the part /etc/init.d/interfaces code:

# Add non interface-specific static-routes.
if [ -f /etc/sysconfig/static-routes ]; then
grep "^any" /etc/sysconfig/static-routes | while read ignore args ; do
/sbin/route add -$args
done
fi

Looks like any must be at the beginning of each line in /etc/sysconfig/static-routes.

/usr/share/doc/initscripts-${VERSION}/sysconfig.txt is a good place to look for these things as well

Friday, June 24, 2011

basename and dirname in UNIXes

I was reading The Unix For Loop today and I found that the following code will fail in the case of a filename like anoldfilename.old:

for i in *.old 
do 
j=`echo $i|sed 's/old/bak/'` 
mv $i $j 
done

I think the following will solve that problem:

j=`basename $i .old`
p=`dirname $i`

mv $i $p/$j.bak


The right tool for the right job!

AWK and Java CLASSPATH

From http://unix-simple.blogspot.com/2008/12/dynamically-building-java-classpaths.html

for line in $java_dir/*.jar
do
  CLASSPATH="$CLASSPATH:$line"
done

Lets put AWK to iterate:

CLASSPATH=$CLASSPATH:$(ls *.jar | awk 'BEGIN { ORS = ":" } { print }')

Maybe a shellish way of do it:

CLASSPATH=$CLASSPATH:`echo *.jar | sed 's/ /:/g'`

Tuesday, June 21, 2011

Prosperity Gospel: Christ Centered or Self Centered?

 The Word of Faith 'Prosperity Gospel' Promotes Material Over Spiritual Needs

Taken from: http://christianity.about.com/od/Word-Of-Faith/a/Prosperity-Gospel.htm?nl=1

Prosperity Gospel: Is Greed a Motive?

"Woe to you, teachers of the law and Pharisees, you hypocrites! You clean the outside of the cup and dish, but inside they are full of greed and self-indulgence." (Matthew 23:25, NIV)

"Watch out! Be on your guard against all kinds of greed; life does not consist in an abundance of possessions." (Luke 12:15, NIV)

"What good is it for someone to gain the whole world, and yet lose or forfeit their very self?" (Luke 9:25, NIV)


Prosperity Gospel: Was Jesus Rich or Poor?

"After this, Jesus traveled about from one town and village to another, proclaiming the good news of the kingdom of God. The Twelve were with him, and also some women who had been cured of evil spirits and diseases: Mary (called Magdalene) from whom seven demons had come out; Joanna the wife of Chuza, the manager of Herod's household; Susanna; and many others. These women were helping to support them out of their own means." Luke 8:1-3 (NIV)

Prosperity Gospel: Do Riches Make Us Right with God?

"Do not store up for yourselves treasures on earth, where moths and vermin destroy, and where thieves break in and steal. But store up for yourselves treasures in heaven, where moths and vermin do not destroy, and where thieves do not break in and steal. For where your treasure is, there your heart will be also...No one can serve two masters. Either you will hate the one and love the other, or you will be devoted to the one and despise the other. You cannot serve both God and money." (Matthew 6:19-21, 23, NIV)

Wealth may build people up in the eyes of men, but it does not impress God. In talking with a rich man, Jesus looked at him and said, 'How hard it is for the rich to enter the kingdom of God!' (Luke 18:24, NIV)

"But godliness with contentment is great gain. For we brought nothing into the world, and we can take nothing out of it. But if we have food and clothing, we will be content with that. Those who want to get rich fall into temptation and a trap and into many foolish and harmful desires that plunge people into ruin and destruction." (1 Timothy 6:6-9, NIV)