Sunday, February 24, 2013

Eesha - Annual Day @ Little Elly Nursery


Eesha had been practicing dance steps for Annul Day celebration for the last couple of weeks..the song is My heart goes sha la la la from Venga boys album...At the function yesterday, Eesha entered from back stage to the dance floor looking for both of us with tears in her eyes...Once reached the floor, she and her partner (I think his name is Kevin) were standing still with hand-in-hand raising my hope that she will start moving legs to the song...but in the next moment, Eesha bursted out into crying and ran towards her teacher...Dance performance of all the kids was pretty good..There was one kid from Eesha's nursery class who refused to leave the dance floor ;-)...It was a great sight to see her enthusiasm and total oblivion to the world around...

After cajoling Eesha to remain calm with multiple offers, we were leaving the function for lunch out and they started playing Gangnam style and to our pleasant surprise, Eesha came back to jubilant mood and made some moves ;-)

Shared some of the photos and video @ Nursery Annual Day @ Manipal County...

Thursday, February 21, 2013

tar creation with option C and effect of globbing



There was a need to archive some logs for investigation...
Without much thought, I fire this command and there it was..bummer!!


[root@mysys rmlater]# tar -zcvf /var/tmp/test.tgz -C /root/myapp/log/ 
appProc.log.*
tar: appProc.log.*: Cannot stat: No such file or directory
tar: Error exit delayed from previous errors


[root@mysys rmlater]# ll /root/myapp/log/appProc.log.*
-rw-r--r-- 1 root root 338928 Feb 22 10:47 /root/myapp/log/appProc.log.0
-rw-r--r-- 1 root root 460000 Feb 20 22:40 /root/myapp/log/appProc.log.1
-rw-r--r-- 1 root root 460000 Feb 18 21:39 /root/myapp/log/appProc.log.2
-rw-r--r-- 1 root root 462685 Feb 16 20:38 /root/myapp/log/appProc.log.3
-rw-r--r-- 1 root root 907643 Feb 14 20:29 /root/myapp/log/appProc.log.4

[root@mysys rmlater]# pwd
/var/tmp/rmlater

Solution 1:
tar -zcvf /var/tmp/test.tgz /root/myapp/log/appProc.log.*

Solution 2:
cd /root/myapp/log/; tar -zcvf /var/tmp/test.tgz appProc.log.*

Difference between Solution 1 and Solution 2:
1) The files are archived in package structure opt/cpf/oma/esymacstarter/. You will see the 

appProc.log.* under opt/cpf/oma/esymacstarter/ when you extract the test.tgz

2) The files are archived into test.tgz without any package structure

Now looking at the error:
tar: appProc.log.*: Cannot stat: No such file or directory

tar -C option => Instructs tar to change the working directory and perform archiving

Reason why it failed: Due to the wildcard pattern and how it is interpreted by shell
Shell expands the files into matching files as per the wild card pattern. This operation is 
called "globbing"...

When shell does globbing, it does so from the current working directory - It checks for 
files matching "appProc.log.*" in /var/tmp/rmlater

[root@mysys rmlater]# ll
total 0
-rw-r----- 1 root root 0 Feb 22 11:25 opt


No files matching appProc.log.* => Cannot stat: No such file or directory

Why use -C option then:

It comes handy when when you want to go to multiple directories and archive different files from them. Most importantly, when you want to put them into one tgz file!!

One use case I can think of is collecting logs for different SW modules from more than one 
folder. In case you want to explore tar options in detail, check out this excellent resource GNU tar manual

Tuesday, February 19, 2013

Visited Eesha's school

Last weekend on Saturday 16th Feb, we visited Eesha's (my daughter ;-) ) school to participate in the parent enrichment programme. It was a two hours session on the power of concentration and the numerous ways to help engage the child into developing this faculty. This was the second session that we attended and it gave me a glimpse of their approach towards education. I'm quite happy about the fact that Eesha will start her education journey at such school...More info about the session here

Thursday, February 14, 2013

Linux: cpu information processor vs core vs socket

When you run /proc/cpuinfo on linux system, you get the cpu information of the hardware.

I try to explain how to interpret the cpu infomation in order to understand the number of physical processors and whether it is single or dual or quad core and whether hyperthreading is enabled.


processor:    Defines the number of processors on the system (logical)
physical id:   Number of CPU Sockets (physical) - Also referred as Chip - This is what is plugged onto mother board.
core id:        Identifies a particular logical core
cpu cores:    Number of cores (1-Single/2-Dual/4-Quad/8-Octa)
siblings:        Indicates whether hyper threading enabled. If "Number of cores" == siblings, then hyper threading is OFF ; else ON

For e.g look at the below sample:


[root@myhome ~]# cat /proc/cpuinfo | /bin/egrep 'processor|physical |core|sibl' | tr -d "\n" | sed s/processor/\\nprocessor/g | grep -v ^$ | sort -u
processor       : 0physical id  : 1siblings     : 8core id              : 0cpu cores    : 4
processor       : 1physical id  : 1siblings     : 8core id              : 2cpu cores    : 4
processor       : 2physical id  : 1siblings     : 8core id              : 1cpu cores    : 4
processor       : 3physical id  : 1siblings     : 8core id              : 3cpu cores    : 4
processor       : 4physical id  : 1siblings     : 8core id              : 0cpu cores    : 4
processor       : 5physical id  : 1siblings     : 8core id              : 2cpu cores    : 4
processor       : 6physical id  : 1siblings     : 8core id              : 1cpu cores    : 4
processor       : 7physical id  : 1siblings     : 8core id              : 3cpu cores    : 4

Physical id  => 1 => Single CPU Socket/Chip
Cpu cores   => 4 => Quad Core Processor


This system has 1 Physical CPU Socket - Quad Core Processor configured with hyper threading ON...