Pages

Monday, August 5, 2013

puppet augeas

Augeas controls configuration files composed of key/value pairs. It might seem weird and hard to use at the beginning, but it's sure easier and friendlier then grep and sed.
Controlling the hostname with augeas and restarting rsyslog service:

class hostname ($hostname){
  augeas{ 'sysconf-hostname':
    context     => '/files/etc/sysconfig/network',
    changes     => ["set HOSTNAME $hostname"],
    notify      => Service['rsyslog'],
  }


augtool is a very nice tool which help you figure out which files and options are under augeas control.

Wednesday, March 13, 2013

bash loop interval

For loop in bash using an interval is fairly simple:
    for i in {1..3}; do echo "r${i}r";done
It becomes a bit more complicated if you want to use a parametric value for the end of the interval:
    n=5
    for i in $(seq 1 $n);do echo "r${i}r";done

Tuesday, March 12, 2013

setting LANG environment variable

Setting LANG environment variable in linux sounds as an easy task:
    export LANG=en_US.utf8
But when attempting to make this change permanent, it is no longer an easy task. Exporting this in /etc/profile, ~/.bashrc or ~/.bash_profile does not have the desired effect. 
After doing a fair amount of googling I found out the solution for this: create a file called ~/.i18n which contains you LANG setting:
    cat ~/.i18n
   LANG=en_US.utf8
This does the trick.