code tested on centos 6 working fine.. :)