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.

Wednesday, September 28, 2011

android apps

Smartphones are for everybody nowadays.  Everything is accessible from your phone: email, IM, youtube, facebook, twitter, you name it.

My personal favorites are the android phones. There are tones of apps available to an android phone user. These applications are available among other sites on the android market.

I recently discovered that there is an even simpler way to install apps from the android market on my phone. It's possible to search for the app on your computer and click install. If you are logged into google, it will automatically send you application to your phone. Pretty neat, isn't it?

Maybe you would think about the security implications of this, but I prefer not to get into this. In my opinion privacy and security are long gone. Believing that there is privacy online is quite naive. But as long as I'm not a spy and I know that people won't get out of their way to find out where I am and what I do, I really don't care. I prefer to enjoy these cool features that make our life easy and pleasant.

Tuesday, September 13, 2011

add disk to lvm


Suppose the Disk is /dev/sdb, the second scsi disk,

  fdisk /dev/sdb
  create as many partitions as you need using command n
  Label them with command t as 8e for making it Linux LVM
  Write and Exit with the command w.

Format the partitions you require using mkfs command

  mkfs -t ext3 -c /dev/sdb1

LVM commands

  pvcreate /dev/sdb1
  vgextend VolGroup00 /dev/sdb1
  lvextend -L 15G /dev/VolGroup00/LogVol00 ;for extending LogVol to 15GB
  lvextend -L+1G /dev/VolGroup00/LogVol00 ;for adding one more GB to Logical Volume LogVol01
  resize2fs /dev/VolGroup00/LogVol00 ;for resizing the Logical Volumes

To increase the storage capacity while keeping the server online, add the disk and then rescan scsi:  

echo "- - -" > /sys/class/scsi_host/host0/scan

Monday, September 12, 2011

control cron from puppet

There is a nice way to control crontab from puppet. An example:


        cron { do_smt:
                command  => "/root/do_smt.sh",
                user     => root,
                hour     => 17,
                minute   => 30,
                monthday => '1-7',
                weekday  => 'Sat',
                month    => [1, 3, 5, 7, 9, 11],
        }

This would lead to a cron entry like this:

# HEADER: This file was autogenerated at Thu Sep 01 20:31:35 +0900 2011 by puppet.
# HEADER: While it can still be managed manually, it is definitely not recommended.
# HEADER: Note particularly that the comments starting with 'Puppet Name' should
# HEADER: not be deleted, as doing so could cause duplicate cron jobs.
# Puppet Name: do_smt
30 17 1-7 1,3,5,7,9,11 6 /root/do_smt.sh

For a complete reference to all the puppet cron type's attributes, check the puppet documentation site.

Saturday, September 3, 2011

vacation highlights

I was in vacation this summer. I almost forgot about it already, so I think it's a good idea to make a post about it, it might help remember.

The Lost World (lumea pierduta) - Padis Mountains


The atmosphere there is very strange, the woods are quiet and deserted. The silence is overwhelming.

The old railroad (Mocanita) - Viseu, Maramures County:







And finally, me in vacation mood, heading to Bohodei waterfall, maybe longest waterfall in Romania (?):