<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-3341953160726374446</id><updated>2012-02-17T02:34:01.967-08:00</updated><category term='openvz changes cron times'/><category term='delay'/><category term='extentions'/><category term='wget'/><title type='text'>Salvaging my IT skills....</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://samixblog.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3341953160726374446/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://samixblog.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>samix</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>39</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-3341953160726374446.post-4712794040709237063</id><published>2012-02-17T02:27:00.000-08:00</published><updated>2012-02-17T02:34:01.979-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='openvz changes cron times'/><title type='text'>OpenVZ changes and randomizes cron times</title><content type='html'>We use the OpenVZ virtulization platform for our servers, we have servers that run up to 32 virtual machines based on the configuration of the hardware node.&lt;br /&gt;&lt;br /&gt;Our setup requires that each of these virtual machines running on top of the hardware node be the same in every respect, down to the timing of the last cron. We have cooked up a custom template of a virtual machine, loaded with all that we want and use puppet to quickly deploy and destroy virtual machines. During operations we realized that our crons were not running at the same time, rather we saw the results of the cron scripts appear at odd times, when we did not want them to run. On checking the various cron files on the VM's we discovered that the cron times for all the cron jobs had changed.&lt;br /&gt;&lt;span class="MsgBodyText"&gt;&lt;/span&gt;&lt;br /&gt;&lt;blockquote class="tr_bq"&gt;&lt;pre&gt;container 111&lt;br /&gt;# start atop daily at midnight&lt;br /&gt;32 1 * * * root /etc/atop/atop.daily&lt;br /&gt;container 112&lt;br /&gt;# start atop daily at midnight&lt;br /&gt;6 3 * * * root /etc/atop/atop.daily&lt;br /&gt;container 113&lt;br /&gt;# start atop daily at midnight&lt;br /&gt;40 1 * * * root /etc/atop/atop.daily&lt;br /&gt;container 114&lt;br /&gt;# start atop daily at midnight&lt;br /&gt;18 1 * * * root /etc/atop/atop.daily&lt;br /&gt;container 115&lt;br /&gt;# start atop daily at midnight&lt;br /&gt;9 2 * * * root /etc/atop/atop.daily&lt;br /&gt;container 116&lt;br /&gt;# start atop daily at midnight&lt;br /&gt;25 1 * * * root /etc/atop/atop.daily&lt;br /&gt;container 117&lt;br /&gt;# start atop daily at midnight&lt;br /&gt;43 2 * * * root /etc/atop/atop.daily&lt;br /&gt;container 118&lt;br /&gt;# start atop daily at midnight&lt;br /&gt;29 1 * * * root /etc/atop/atop.daily&lt;/pre&gt;&lt;/blockquote&gt;We were surprised because we were creating the VM's from the same custom template, hence they should have had the same cron job times, poking around further we realized that the vzctl runs a script &lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;/etc/vz/dists/scripts/postcreate.sh&lt;/span&gt; that is run inside each VM when it is created. Apart from the other thing that it does, it also randomized the cron job times in the following files &lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;/etc/crontab&lt;/span&gt; and all files under &lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;/etc/cron.d/&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Though this might be a wanted feature on a shared hosting platform, it was creating problems for us, as we are not using OpenVZ for shared hosting, We raised a &lt;a href="http://bugzilla.openvz.org/show_bug.cgi?id=2174" target="_blank"&gt;bug&lt;/a&gt; report for this, and the OpenVZ dev team has been kind enough to look into this, starting &lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;vzctl-3.0.31&lt;/span&gt;, you can just put the following token VZCTL_POSTCREATE_SKIP as a comment somewhere in the cron file so that &lt;a href="http://git.openvz.org/?p=vzctl;a=blobdiff;f=etc/dists/scripts/postcreate.sh;h=e583bd9f613606d68f80a4ca55c32de7c9f0f294;hp=874f2e9a7c3122b412334e73ce2937d90c8b05c5;hb=0394f75c7;hpb=8d75c912feced346e4d26b1687659023fa0a6172" style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;postcreate.sh&lt;/a&gt; does not randomize the cron jobs in that file.&lt;br /&gt;&lt;br /&gt;If you want to stop randomizing your crons before the new vzctl release or are sure that you will not be ever using the crontab randomizer, like we are, it bodes well to just comment out the call to the function &lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;randcrontab&lt;/span&gt; in the &lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;postcreate.sh&lt;/span&gt; script, and never worry about it ever again.&lt;br /&gt;&lt;span class="MsgBodyText"&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3341953160726374446-4712794040709237063?l=samixblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://samixblog.blogspot.com/feeds/4712794040709237063/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://samixblog.blogspot.com/2012/02/openvz-crontab-randomizer.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3341953160726374446/posts/default/4712794040709237063'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3341953160726374446/posts/default/4712794040709237063'/><link rel='alternate' type='text/html' href='http://samixblog.blogspot.com/2012/02/openvz-crontab-randomizer.html' title='OpenVZ changes and randomizes cron times'/><author><name>samix</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3341953160726374446.post-1462768215843025457</id><published>2012-01-23T00:05:00.000-08:00</published><updated>2012-01-23T00:09:41.870-08:00</updated><title type='text'>Squid 3.1 forwarded-for not working to hide client IP</title><content type='html'>Before allowing an action some websites test the IP address of the connection as a policy, some go as far to check the X-Forwarded-For header, this can create problems for users, as most of the times the IP's that admin's will use behind a proxy server will be private IP's and as such the website may disallow access to a client on getting this private IP through the X-forwarded-For header, qatarliving.com is one such website that checks the X-Forwarded-For header , I had blogged about this specific case &lt;a href="http://samixblog.blogspot.com/2012/01/squid-proxy-and-qatarlivingcom-issues.html" target="_blank"&gt;here&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;To stop squid from sending the IP address of the client, the option that needs to be used in the squid.conf file is &lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;forwarded_for&lt;/span&gt;, previously I was using squid-2.6 stable, and the parameter &lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;forwarded_for off&lt;/span&gt; sufficed and removed the X-forwarded-for header, but in squid-3.1 I learn from the release notes that the arguments to the parameter &lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;forwarded-for&lt;/span&gt; have been changed&lt;br /&gt;&lt;blockquote class="tr_bq" style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;If set to "transparent", &lt;br /&gt;Squid will not alter the X-Forwarded-For header in any way.&lt;br /&gt;&lt;br /&gt;If set to "delete", &lt;br /&gt;Squid will delete the entire X-Forwarded-For header.&lt;br /&gt;&lt;br /&gt;If set to "truncate", &lt;br /&gt;Squid will remove all existing X-Forwarded-For entries, and place the client IP as the sole entry.&lt;/blockquote&gt;Thus if, you want to hide the client IP in squid-3.1 you will have to set the forwarded-for parameter as&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;:&lt;/span&gt;&lt;br /&gt;&lt;blockquote class="tr_bq"&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;forwarded-for delete&lt;/span&gt;&lt;/blockquote&gt;This should now delete the complete X-forwarded-For header from the proxy request sent by squid&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3341953160726374446-1462768215843025457?l=samixblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://samixblog.blogspot.com/feeds/1462768215843025457/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://samixblog.blogspot.com/2012/01/squid-31-forwarded-for-not-working-to.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3341953160726374446/posts/default/1462768215843025457'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3341953160726374446/posts/default/1462768215843025457'/><link rel='alternate' type='text/html' href='http://samixblog.blogspot.com/2012/01/squid-31-forwarded-for-not-working-to.html' title='Squid 3.1 forwarded-for not working to hide client IP'/><author><name>samix</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3341953160726374446.post-2946292972380947427</id><published>2012-01-18T02:14:00.000-08:00</published><updated>2012-01-18T08:34:33.903-08:00</updated><title type='text'>Creating a simple yum repository</title><content type='html'>This is a simple howto about creating your own YUM Repo. We will use apache to expose this repository to yum clients&lt;br /&gt;&lt;br /&gt;Steps to be performed on the server &lt;br /&gt;# Install the createrepo rpm&lt;br /&gt;&lt;blockquote class="tr_bq" style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;yum install createrepo&lt;/blockquote&gt;# create the directory that apache will use to serve the rpm's and other contents, the x86_64 directory will hold 64 bit rpm's and i386 will hold 32 bit rpm's&lt;br /&gt;&lt;blockquote class="tr_bq" style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;mkdir -p /var/www/html/repo/x86_64/base&lt;br /&gt;mkdir -p /var/www/html/repo/i386/base&lt;/blockquote&gt;# copy a rpm to these directories&lt;br /&gt;&lt;blockquote class="tr_bq" style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;cp trafficserver-3.0.0-2.x86_64.rpm /var/www/html/repo/x86_64/base&lt;br /&gt;cp trafficserver-3.0.0-2.i386.rpm /var/www/html/repo/i386/base &lt;/blockquote&gt;# now we will run createrepo so that it will create the metadata files required by the yum client&lt;br /&gt;&lt;blockquote class="tr_bq" style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;cd /var/www/html/repo/x86_64/base&lt;br /&gt;createrepo -v .&lt;br /&gt;&lt;br /&gt;cd /var/www/html/repo/i386/base&lt;br /&gt;createrepo -v .&lt;/blockquote&gt;&amp;nbsp;# expose the repository using apache, a simple vhost configuration would be something like below&lt;br /&gt;&lt;blockquote class="tr_bq"&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;vi /etc/httpd/conf.d/repo.conf &lt;/div&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;lt;VirtualHost repo.example.com&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ServerAdmin webmaster@repo.example.com&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; DocumentRoot /var/www/html/repo&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ServerName repo.example.com&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ErrorLog logs/repo-error_log&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; CustomLog logs/repo-access_log common&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;lt;/VirtualHost&amp;gt;&lt;/span&gt;&lt;/blockquote&gt;&lt;br /&gt;Now, we move on to the clinet, assume that we are working on a 64 bit machine, and require to install the trafficserver-3.0.0-2.x86_64.rpm rpm. We need to create a repo file under /etc/yum.repos.d&lt;br /&gt;&lt;br /&gt;# create a repo file under /etc/yum.repos.d&lt;br /&gt;&lt;blockquote class="tr_bq" style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;vi /etc/yum.repos.d/myrepo.repo&lt;br /&gt;[myrepo]&lt;br /&gt;name = My Very Own Repo&lt;br /&gt;baseurl = http://repo.example.com/x86_64/base&lt;br /&gt;enabled = 1&lt;br /&gt;gpgcheck = 0&lt;/blockquote&gt;# next, install the trafficserver rpm&lt;br /&gt;&lt;blockquote class="tr_bq"&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;yum install trafficserver&lt;/span&gt;&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3341953160726374446-2946292972380947427?l=samixblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://samixblog.blogspot.com/feeds/2946292972380947427/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://samixblog.blogspot.com/2012/01/creating-simple-yum-repository.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3341953160726374446/posts/default/2946292972380947427'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3341953160726374446/posts/default/2946292972380947427'/><link rel='alternate' type='text/html' href='http://samixblog.blogspot.com/2012/01/creating-simple-yum-repository.html' title='Creating a simple yum repository'/><author><name>samix</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3341953160726374446.post-1960527126125867809</id><published>2012-01-09T07:13:00.000-08:00</published><updated>2012-01-09T07:15:40.206-08:00</updated><title type='text'>Puppetizing OpenVZ container creation</title><content type='html'>I am currently using puppet-virt module by Carla Souza to puppetize vm creation and management, the module is quite extensive and easy to understand and implement.&lt;br /&gt;&lt;br /&gt;Here, I am going to handle the creation of a simple centos VM . For people out there who do not know how to use a third party puppet module, just like me before using this one, read on. The module is hosted here https://github.com/carlasouza/puppet-virt/&lt;br /&gt;&lt;br /&gt;Move into your modules directory and then do a git pull&lt;br /&gt;&lt;blockquote class="tr_bq"&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;git pull http://github.com/carlasouza/puppet-virt.git &lt;/span&gt;&lt;/blockquote&gt;Move into the /etc/puppet/modules/puppet-virt/manifests directory and backup the init.pp, we are not going to use this for this tutorial, we will write our own.&lt;br /&gt;&lt;br /&gt;Now let us create a file init.pp and define a simple VM inside it with resource parameters.&lt;br /&gt;&lt;blockquote class="tr_bq" style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;class puppet-virt { &amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; virt { 'testserver.com':&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ipaddr =&amp;gt; ['192.168.3.80'],&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ensure&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; =&amp;gt; 'installed',&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; id&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; =&amp;gt; 615,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; os_template =&amp;gt; 'centos-5',&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; virt_type&amp;nbsp; =&amp;gt; 'openvz',&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; autoboot&amp;nbsp;&amp;nbsp; =&amp;gt; 'false',&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ve_root =&amp;gt; '/vz/root/$VEID',&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ve_private =&amp;gt; '/vz/private/$VEID',&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; configfile =&amp;gt; 'vzsplit',&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; resources_parameters =&amp;gt; ["VMGUARPAGES=3145728","OOMGUARPAGES=3145728","PRIVVMPAGES=3145728"],&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; nameserver =&amp;gt; ['4.2.2.2','8.8.8.8'],&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; diskspace =&amp;gt; '26214400:26214400',&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/blockquote&gt;&lt;blockquote&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;}&lt;/span&gt;&lt;/blockquote&gt;Add, include puppet-virt in your sites.pp under the appropriate node and run the puppet agent, if you are using CentOS you will get the following error&lt;br /&gt;&lt;blockquote class="tr_bq" style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;"Sorry, this provider is not supported for your Operation System, yet" &lt;/blockquote&gt;To resolve this, just add CentOS to /etc/puppet/modules/puppet-virt/lib/puppet/provider/virt/openvz.rb file on the line that looks like this(currently it is line no 10)&lt;br /&gt;&lt;blockquote class="tr_bq"&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;if [ "Ubuntu", "Debian"].any? { |os| Facter.value(:operatingsystem) == os }&lt;/span&gt;&lt;br /&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;/div&gt;&lt;/blockquote&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;make the above line look like&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;/div&gt;&lt;blockquote style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;if [ "Ubuntu", "Debian", &lt;b&gt;"CentOS"&lt;/b&gt;].any? { |os|&amp;nbsp; Facter.value(:operatingsystem) == os }&lt;/blockquote&gt;Now, run the puppet agent again and your virtual machine should be up and running.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3341953160726374446-1960527126125867809?l=samixblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://samixblog.blogspot.com/feeds/1960527126125867809/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://samixblog.blogspot.com/2012/01/puppetizing-openvz-container-creation.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3341953160726374446/posts/default/1960527126125867809'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3341953160726374446/posts/default/1960527126125867809'/><link rel='alternate' type='text/html' href='http://samixblog.blogspot.com/2012/01/puppetizing-openvz-container-creation.html' title='Puppetizing OpenVZ container creation'/><author><name>samix</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3341953160726374446.post-76698651635115356</id><published>2012-01-09T06:45:00.000-08:00</published><updated>2012-01-11T08:27:28.292-08:00</updated><title type='text'>OpenVZ vzctl Disk Quota exceeded error</title><content type='html'>I was creating some VM's on a new hardware node using the vzctl --create command, half way through the command I started getting Disk Quota exceeded error&lt;br /&gt;&lt;blockquote class="tr_bq" style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;Creating container private area (centos-5-x86_64)&lt;br /&gt;tar: ./usr/lib64/mono/1.0/mcs.exe: Cannot write: Disk quota exceeded&lt;br /&gt;tar: Skipping to next header&lt;br /&gt;tar: Archive contains obsolescent base-64 headers&lt;br /&gt;tar: ./usr/lib64/mono/1.0/setreg.exe.mdb: Cannot write: Disk quota exceeded&lt;br /&gt;tar: Skipping to next header&lt;br /&gt;tar: ./usr/lib64/mono/1.0/mozroots.exe.mdb: Cannot write: Disk quota exceeded&lt;/blockquote&gt;There were also error messages in /var/log/messages&lt;br /&gt;&lt;blockquote class="tr_bq" style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;Jan 7 09:48:51 server kernel: VZ QUOTA: disk softlimit exceeded for id=111&lt;br /&gt;Jan 7 09:48:54 server kernel: VZ QUOTA: disk hardlimit reached for id=111&lt;/blockquote&gt;Inspite of lot of googling, there was not much that I could use to troubleshoot, I checked to see if there are disk quota's enabled on the disk, but found none.&lt;br /&gt;&lt;br /&gt;After a little looking around and poking I found that I had used vzsplit to create a template configuration file. I passed -n 32 to vzsplit on a disk worth 150G. As a result vzsplit split 150G into 32 parts and set the DISKSPACE parameter very low. Thus during VM creation as the image was being untared, the low disk limit was being reached and vzctl started to complain about disk limit reached.&lt;br /&gt;I was using the 150G disk for the OS, and the plan was to use other secondary disks for the VM root and private area. &lt;br /&gt;&lt;br /&gt;This unveiled another thing about vzsplit, that while splitting resources it only considers the disk that has the OS installed on it, and ignores all other secondary disks attached to the server.&lt;br /&gt;&lt;br /&gt;To continue creating the VM's I manually edited the DISKSPACE parameter set in the file generated by vzsplit to some high value and the --create command completed successfully.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3341953160726374446-76698651635115356?l=samixblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://samixblog.blogspot.com/feeds/76698651635115356/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://samixblog.blogspot.com/2012/01/openvz-vzctl-disk-quota-exceeded-error.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3341953160726374446/posts/default/76698651635115356'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3341953160726374446/posts/default/76698651635115356'/><link rel='alternate' type='text/html' href='http://samixblog.blogspot.com/2012/01/openvz-vzctl-disk-quota-exceeded-error.html' title='OpenVZ vzctl Disk Quota exceeded error'/><author><name>samix</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3341953160726374446.post-726672226996975055</id><published>2012-01-05T04:59:00.000-08:00</published><updated>2012-01-05T05:05:10.766-08:00</updated><title type='text'>Squid proxy 403 forbidden error</title><content type='html'>Recently we had set up squid proxy for our office migrating away from microsoft ISA, everything went ahead fine until someone complained that they had started getting forbidden errors on some websites.&lt;br /&gt;&lt;br /&gt;The actual error message that they encountered on accessing those sites was&lt;br /&gt;&lt;blockquote class="tr_bq"&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;Forbidden&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;You do not have permission to access / on this server.&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;/blockquote&gt;&lt;blockquote&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;Additionally, A 500 Internal Server error was encountered while trying to use an ErrorDocument to handle the request.&lt;/span&gt;&lt;/blockquote&gt;On further testing we found that if we bypassed squid then the site would open up normally, but if we went through squid the site would just return the above error.&lt;br /&gt;&lt;br /&gt;Some friends on IRC suggested that I run tcpdump on the two connections to check the difference between the http headers of web requests sent through squid and the ones sent bypassing squid. Tcpdump revealed requests that were sent throughsquid(2.6) in my case was sending out GET HTTP/1.0 requests, whereas the ones that were being sent bypassing squid, were using GET HTTP/1.1&lt;br /&gt;&lt;br /&gt;To further validate that this itself was the issue, I installed squid-2.7 that has experimental HTTP/1.1 support and turned the following directive on in squid.conf, this causes squid to send HTTP/1.1 requests.&lt;br /&gt;&lt;blockquote class="tr_bq"&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;server_http11 on&lt;/span&gt;&lt;/blockquote&gt;Turning the directive on and sending the requests through squid resulted in normal loading of the the webpage, then I turned the same directive off so that squid would send out HTTP/1.0 headers and the site again stopped working, Amos on the squid mailing list suggests using squid-3.1.&lt;br /&gt;&lt;br /&gt;During the investigation process, I also tried out Apache Traffic Server, and was amazed with it, my perception is that ATS is faster and cleaner, so in case you want to give squid a miss, you can try ATS too, at least I am sticking with Apache Traffic Server as of now and playing with it.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3341953160726374446-726672226996975055?l=samixblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://samixblog.blogspot.com/feeds/726672226996975055/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://samixblog.blogspot.com/2012/01/squid-proxy-403-forbidden-error.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3341953160726374446/posts/default/726672226996975055'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3341953160726374446/posts/default/726672226996975055'/><link rel='alternate' type='text/html' href='http://samixblog.blogspot.com/2012/01/squid-proxy-403-forbidden-error.html' title='Squid proxy 403 forbidden error'/><author><name>samix</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3341953160726374446.post-979701068078191011</id><published>2012-01-03T09:48:00.000-08:00</published><updated>2012-01-23T00:06:53.644-08:00</updated><title type='text'>Squid proxy and qatarliving.com issues</title><content type='html'>&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;Note: Refer &lt;/span&gt;&lt;a href="http://samixblog.blogspot.com/2012/01/squid-31-forwarded-for-not-working-to.html" style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" target="_blank"&gt;here&lt;/a&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt; if you are using squid-3.1 or above &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;We recently moved to squid proxy for our office today from ISA(yes linux will finally take over Qatar too inshaAllah), considering that our office is based out of Qatar, most people use the website qatarliving.com.&lt;br /&gt;&lt;br /&gt;qatarliving.com implements a policy of allowing only people from Qatar to post classifieds, in a bid to accompalish this, the code at qatarliving checks the source IP, after putting in squid, users in my office started getting errors from qatarliving where they are unable to post classifieds as qatarliving did not recognize them as being from within Qatar.&lt;br /&gt;&lt;br /&gt;I tried whatismyip.com and got a proper Qatar IP, but still qatarliving was not recognizing my connections that emanated from behind squid as being from Qatar, frantic googleling revealed that squid also adds a forwarded-for header with the IP of the users machine(private in my case), thus because of this header qatarliving was considering my internal ips as the source ip and ignoring the actual ip that made the connection.&lt;br /&gt;&lt;br /&gt;Fixing, this is fairly simple, just turn the forwarded-for option in squid.conf to off.&lt;br /&gt;&lt;blockquote class="tr_bq"&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;forwarded-for off&lt;/span&gt; &lt;/blockquote&gt;So now squid will not send this header any more, and qatarliving will now consider the connecting source IP.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3341953160726374446-979701068078191011?l=samixblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://samixblog.blogspot.com/feeds/979701068078191011/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://samixblog.blogspot.com/2012/01/squid-proxy-and-qatarlivingcom-issues.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3341953160726374446/posts/default/979701068078191011'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3341953160726374446/posts/default/979701068078191011'/><link rel='alternate' type='text/html' href='http://samixblog.blogspot.com/2012/01/squid-proxy-and-qatarlivingcom-issues.html' title='Squid proxy and qatarliving.com issues'/><author><name>samix</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3341953160726374446.post-4664042787596799163</id><published>2011-12-16T10:02:00.000-08:00</published><updated>2011-12-16T10:04:32.805-08:00</updated><title type='text'>WebService::Solr and solr group query support</title><content type='html'>WebService::Solr is an amazing perl module for interacting with Apache Solr, by default after you fire a query using WebService::Solr, it returns an array with the response from the solr server.&lt;br /&gt;&lt;br /&gt;Unfortunately, it seems that the using the response-&amp;gt;docs method, fails on grouped queries with the following error&lt;br /&gt;&lt;blockquote class="tr_bq" style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;Attribute (docs) does not pass the type constraint because: Validation failed for 'ArrayRef' failed with value undef at perl-group.pl line 30&lt;/blockquote&gt;But before the above error, WebService::Solr does receive the response from the Solr server and it is just a matter of accessing step by step and making it available, below is the code snippet that can be used to get the complete group result&lt;br /&gt;&lt;br /&gt;Step-1: Query the solr server&lt;br /&gt;&lt;blockquote class="tr_bq" style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;# search &amp;amp; get hits&lt;br /&gt;my $response = $solr-&amp;gt;search( $sent_query, {'rows' =&amp;gt; '1000000', 'group' =&amp;gt; 'true', 'group.field' =&amp;gt; 'id', 'group.limit' =&amp;gt; '50', 'fl' =&amp;gt; 'text'});&lt;/blockquote&gt;Step-2: Save the&amp;nbsp; hashref of deserialized JSON data from the response by WebService::Solr in to a variable &lt;br /&gt;&lt;blockquote class="tr_bq" style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;my $hits = $response-&amp;gt;content;&lt;br /&gt;my %hits = %$hits;&lt;/blockquote&gt;Step-3:&amp;nbsp; Get the groups that contain the results&lt;br /&gt;&lt;blockquote class="tr_bq" style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;my $response_header = $hits{grouped}{id}{groups};&lt;br /&gt;my @response_header = @$response_header;&lt;/blockquote&gt;Step-4: Each group contains arrays that contain element with response from the solr server&lt;br /&gt;&lt;blockquote class="tr_bq"&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;foreach my $group (@response_header) {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; my $textarray = $group-&amp;gt;{doclist}{docs};&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; my @textarray = @$textarray;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; foreach(@textarray) {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print $_-&amp;gt;{text}[0],"\n";&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;}&lt;/span&gt;&lt;/blockquote&gt;&lt;br /&gt;Here is &lt;a href="https://github.com/samix119/Project-Code/blob/master/solr/perl-group.pl" target="_blank"&gt;sample code&lt;/a&gt; to use in case the above explanation is confusing.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3341953160726374446-4664042787596799163?l=samixblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://samixblog.blogspot.com/feeds/4664042787596799163/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://samixblog.blogspot.com/2011/12/webservicesolr-and-solr-group-query.html#comment-form' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3341953160726374446/posts/default/4664042787596799163'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3341953160726374446/posts/default/4664042787596799163'/><link rel='alternate' type='text/html' href='http://samixblog.blogspot.com/2011/12/webservicesolr-and-solr-group-query.html' title='WebService::Solr and solr group query support'/><author><name>samix</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3341953160726374446.post-7083741198460880232</id><published>2011-12-11T21:24:00.000-08:00</published><updated>2011-12-11T21:33:44.485-08:00</updated><title type='text'>Fetch numFound using Webservice::Solr</title><content type='html'>WebService::Solr is a perl module that you can use to interface with Apache Solr, inserting, retrieving/seraching documents and other indexing functions.&lt;br /&gt;&lt;br /&gt;When you make a query using WebService::Solr it returns(the document states) among other stuff&lt;br /&gt;&lt;br /&gt;# an array with the actual search results&lt;br /&gt;# an hash ref to that contains the entire response from solr&lt;br /&gt;&lt;br /&gt;Using WebService::Solr you can set the number of rows that you want to receive, but sometimes you may just want to know the number of records found with a particular search, you can do this by counting the number of elements in the array that WebService::Solr returns as part of the response packet, but if you receive like a million records, it defeats the purpose of speed.&lt;br /&gt;&lt;br /&gt;Thus another way is to set rows =&amp;gt; 0, so that solr does not spend time in sending the actual search results but only sends you the response header with the numFound field, it sends this header with search results also. &lt;br /&gt;&lt;br /&gt;But, here is where the easy part ends, as fetching the numFound field resulted in dumping hashref after hashref to finally reach the numFound record, you can save time by using the code snippet below.&lt;br /&gt;&lt;br /&gt;Basically you have to shun receiving the array after firing the query and will have to store the hashref content&lt;br /&gt;&lt;blockquote class="tr_bq" style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;# we are not interested in the array from the response&lt;br /&gt;my $response = $solr-&amp;gt;search( $sent_query, {'rows' =&amp;gt; '0'});&lt;br /&gt;my @hits = $response-&amp;gt;docs;&lt;br /&gt;&lt;br /&gt;# we are not interested in the array from the response&lt;br /&gt;my $response = $solr-&amp;gt;search( $sent_query, {'rows' =&amp;gt; '0'});&lt;br /&gt;my $hashref = $response-&amp;gt;content;&lt;/blockquote&gt;Once we have the hashref, then its only a matter of dereferencing it and reaching the numFound key, or we can dereference in the same step as below&lt;br /&gt;&lt;blockquote class="tr_bq" style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;$numfound = $response-&amp;gt;content-&amp;gt;{response}-&amp;gt;{numFound};&lt;/blockquote&gt;Complete code snippet for this operation can be found &lt;a href="https://github.com/samix119/Project-Code/blob/master/solr/webservice-solr-numfound.pl" target="_blank"&gt;here&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3341953160726374446-7083741198460880232?l=samixblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://samixblog.blogspot.com/feeds/7083741198460880232/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://samixblog.blogspot.com/2011/12/fetch-numfound-using-webservicesolr.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3341953160726374446/posts/default/7083741198460880232'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3341953160726374446/posts/default/7083741198460880232'/><link rel='alternate' type='text/html' href='http://samixblog.blogspot.com/2011/12/fetch-numfound-using-webservicesolr.html' title='Fetch numFound using Webservice::Solr'/><author><name>samix</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3341953160726374446.post-2939836035757976845</id><published>2011-12-09T04:41:00.000-08:00</published><updated>2011-12-09T04:41:52.467-08:00</updated><title type='text'>Getting started with Apache Solr</title><content type='html'>Apache solr as the site describes "Solr is the popular, blazing fast open source enterprise search platform from the Apache Lucene project.  Its major features include powerful full-text search, hit highlighting, faceted search, dynamic clustering, database integration, rich document (e.g., Word, PDF) handling, and geospatial search.  Solr is highly scalable, providing distributed search and index replication, and it powers the search and navigation features of many of the world's largest internet sites."&lt;br /&gt;&lt;br /&gt;cool, but beyond this most of the tutorials on the web expect some pre knowldge about search, indexing, handling xml based configuration files to the extent that after a few paragraphs I started to loose the author.&lt;br /&gt;&lt;br /&gt;The way to download and install solr are well documented in the solr tutorial, and getting it up and running is pretty simple, the challenge begins after firing up solr.&lt;br /&gt;&lt;br /&gt;assume the following scenario, I want to index some pdf's and make solr return the filename of the pdf once the user performs a search. The catch here is that first you will have to define a field in the example/solr/conf/schema.xml file to hold the filename, in the schema file look for fields tag and define a filename field&lt;br /&gt;&lt;blockquote class="tr_bq" style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;lt;field name="filename" type="string" indexed="true" stored="true"/&amp;gt;&lt;br /&gt;&lt;br /&gt;where, name = name of the field&lt;br /&gt;type=datatype&lt;br /&gt;indexed=should data in this field be indexed&lt;br /&gt;stored=if this field data should be returned in search&lt;/blockquote&gt;now, time to index a pdf file, we will use curl to do this, you have to also send in a field literal.filename to hold the name of the file that you are indexing literal.id is the unique id that you want this document to have&lt;br /&gt;&lt;blockquote class="tr_bq"&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;curl "http://localhost:8983/solr/update/extract?literal.id=doc1&amp;amp;literal.filename=test.pdf" -F "myfile=@test.pdf"&lt;/div&gt;&lt;/blockquote&gt;That's it, your pdf is indexed and now you can go to the solr search interface and fire up search queries that will return the name of the pdf.&lt;br /&gt;&lt;br /&gt;But sooner or later you will realize that if you search with a search query like 'test.pdf' ie the name of the pdf file, inspite of you asking solr to index it in the schema.xml file, your search turns up blank.&lt;br /&gt;&lt;br /&gt;This is because the default search field in the schema.xml file is set to "text", the default field which is used for search if you do not specify the field to search in. Thus if you want to search the filename field you will have to make you query look like&lt;br /&gt;&lt;blockquote class="tr_bq" style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt; filename:test.pdf&lt;/blockquote&gt;&amp;nbsp;If you do now want to specify the field name in the search, then another method is to ask solr to copy the contents of the filename filed into the text filed using the below syntax in the schema.xml file&lt;br /&gt;&lt;blockquote class="tr_bq"&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;lt;copyField source="filename" dest="text"/&amp;gt; &lt;/span&gt;&lt;/blockquote&gt;Now, you should have solr return your filename in the search, with or without mentioning the fieldname&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3341953160726374446-2939836035757976845?l=samixblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://samixblog.blogspot.com/feeds/2939836035757976845/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://samixblog.blogspot.com/2011/12/getting-started-with-apache-solr.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3341953160726374446/posts/default/2939836035757976845'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3341953160726374446/posts/default/2939836035757976845'/><link rel='alternate' type='text/html' href='http://samixblog.blogspot.com/2011/12/getting-started-with-apache-solr.html' title='Getting started with Apache Solr'/><author><name>samix</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3341953160726374446.post-1474665355653376152</id><published>2011-12-05T09:54:00.000-08:00</published><updated>2011-12-06T01:29:58.345-08:00</updated><title type='text'>Recusring through FTP Directory Structure and getting File Listing</title><content type='html'>We have a remote FTP site that hosts a lot of files for a project that we are currently conducting, yesterday one user requested if there was a way for them to enter some string and search if a filename existed with that string, so that they can then go ahead and download it.&lt;br /&gt;&lt;br /&gt;The idea here is not to download the files hosted on the FTP site, just get the file names, there were lot of helpful perl modules and sample scripts around, finally after reading a lot of excellent stuff on the net I was able to cook up this perl script with a recursion function, that crawls the FTP site and collects the file names.&lt;br /&gt;&lt;br /&gt;The script uses Net::FTP and Net::FTP::File to accompalish this task and a recurse function crawl_tree(), here is the script on &lt;a href="https://github.com/samix119/Project-Code/blob/master/ftp-crawl/ftp-crawl.pl" target="_blank"&gt;github&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Another way to accomplish the same thing is is via wget but with a little twist, using the --spider, --no-delete-listing options&lt;br /&gt;&lt;blockquote class="tr_bq" style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;wget --ftp-user='user' --ftp-password='pass' ftp://ftpsite.com --spider -r --no-remove-listing -l 0&lt;/blockquote&gt;This creates the entire FTP dir structure, but because of the --spider option no files are downloaded and because of the --no-remove-listing, a listing. file is created in each directory that you can then check to get the names of the files that are supposed to be present in that directory.&lt;br /&gt;&lt;br /&gt;Beyond this, things were quiet simple, wrote a simple perl script that traversed through the directory structure created by wget on the local machine, reading listing. files in each directory getting a list of files that are available at the FTP site, created an index and gave my users a search interface.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3341953160726374446-1474665355653376152?l=samixblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://samixblog.blogspot.com/feeds/1474665355653376152/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://samixblog.blogspot.com/2011/12/recusring-through-ftp-directory.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3341953160726374446/posts/default/1474665355653376152'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3341953160726374446/posts/default/1474665355653376152'/><link rel='alternate' type='text/html' href='http://samixblog.blogspot.com/2011/12/recusring-through-ftp-directory.html' title='Recusring through FTP Directory Structure and getting File Listing'/><author><name>samix</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3341953160726374446.post-2316403138049099942</id><published>2011-11-28T08:31:00.000-08:00</published><updated>2011-11-28T08:34:46.288-08:00</updated><title type='text'>Migrating OpenVZ Vm's</title><content type='html'>Recently one of our OpenVZ servers was getting blocked on disk, thus we decided to add disk and move out some of the VM's to this new disk.&lt;br /&gt;&lt;br /&gt;Below is the process that we followed to avoid check pointing etc.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;create the new directory structure&lt;/b&gt;&lt;br /&gt;&lt;blockquote class="tr_bq" style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;# mkdir /disk/vz/private&lt;br /&gt;# mkdir /disk/vz/root&lt;br /&gt;# chmod 700&amp;nbsp; /disk/vz/private&lt;br /&gt;# chmod 700&amp;nbsp; /disk/vz/root&lt;/blockquote&gt;&lt;b&gt;stop the VM&lt;/b&gt;&lt;br /&gt;&lt;blockquote class="tr_bq" style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;# vzctl stop 111&lt;/blockquote&gt;&lt;b&gt;move the VM data to the new disk&lt;/b&gt;&lt;br /&gt;&lt;blockquote class="tr_bq" style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;# mv /vz/private/111 /disk/vz/private/111&lt;/blockquote&gt;&lt;b&gt;delete the VM directory in the old root section&lt;/b&gt;&lt;br /&gt;&lt;blockquote class="tr_bq" style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;# rmdir /vz/root/111&lt;/blockquote&gt;&lt;b&gt;delete the old quota file for this vm&lt;/b&gt;&lt;br /&gt;&lt;blockquote class="tr_bq" style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;# rm -f /var/openvz/quota.111&lt;/blockquote&gt;The above step is important because, the old quota file contains quota information for the old paths that do not exist anymore, thus vzquota on fails with the following error&lt;br /&gt;&lt;blockquote class="tr_bq" style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;[root@server ~]# vzctl&amp;nbsp; start 111&lt;br /&gt;Starting container ...&lt;br /&gt;vzquota : (error) Quota on syscall for id 165: No such file or directory&lt;br /&gt;vzquota on failed [3]&lt;/blockquote&gt;&lt;b&gt;start the VM&lt;/b&gt;&lt;br /&gt;&lt;blockquote class="tr_bq"&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;[root@server~]# vzctl&amp;nbsp; start 111&lt;/div&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;Starting container ...&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;Initializing quota ...&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;Container is mounted&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;Adding IP address(es): x.x.x.x&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;Setting CPU units: xxxx&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;Set hostname: xx.xx.xx&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;File resolv.conf was modified&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;Container start in progress...&lt;/span&gt;&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3341953160726374446-2316403138049099942?l=samixblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://samixblog.blogspot.com/feeds/2316403138049099942/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://samixblog.blogspot.com/2011/11/migrating-openvz-vms.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3341953160726374446/posts/default/2316403138049099942'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3341953160726374446/posts/default/2316403138049099942'/><link rel='alternate' type='text/html' href='http://samixblog.blogspot.com/2011/11/migrating-openvz-vms.html' title='Migrating OpenVZ Vm&apos;s'/><author><name>samix</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3341953160726374446.post-2964435263450375774</id><published>2011-11-09T10:23:00.000-08:00</published><updated>2011-11-09T10:32:02.341-08:00</updated><title type='text'>Authenticating web application with google and yahoo</title><content type='html'>&lt;span id="goog_1377133527"&gt;&lt;/span&gt;&lt;span id="goog_1377133528"&gt;&lt;/span&gt;&lt;a href="http://www.blogger.com/"&gt;&lt;/a&gt;Ok, just some hours ago I was grappling with how to authenticate a user with google, specifically with a gmail id and with a yahoo email id. Most of the documentation that I found on the web assumed too much background knowledge, this is my attempt to present the topic for the absolute beginner like... ME.&lt;br /&gt;&lt;br /&gt;Basically, this is the idea, rather than you authenticating the user, you ask google and yahoo to authenticate users for you and then take it from there, the idea is not to pass username and password to yahoo or google, rather it is to let yahoo and google handle everything, right from accepting username and password to authenticating the user. All you do is tell google or yahoo that, here is this user who wants to sign in my website,&amp;nbsp; do you know him ? and if you do, can you please return some of his information, like his username, emailaddress, contact details, if the user wants to share it with the world.&lt;br /&gt;&lt;br /&gt;We will use PHP to write all the code, first off download &lt;a href="http://gitorious.org/lightopenid" target="_blank"&gt;lightopenid&lt;/a&gt;, in this package you will find example-google.php and the actual library openid.php.&lt;br /&gt;&lt;br /&gt;&lt;a href="https://github.com/samix119/Project-Code/blob/master/manage/index.php" target="_blank"&gt;here&lt;/a&gt; is a hacked version of the example-google.php script that requests for the emailaddress along with user authentication request and then sets a encrypted cookie on the user browser.&lt;br /&gt;&lt;br /&gt;The code is self explanatory, the important parts are the following elements&lt;br /&gt;&lt;br /&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;$openid-&amp;gt;identity = 'https://www.google.com/accounts/o8/id';&lt;/div&gt;&lt;br /&gt;This url is the actual url where you will redirect the client to authenticate with google, the technical term for this url is 'openid discovery url'&lt;br /&gt;&lt;br /&gt;So now it is fairly simple, if you want to authenticate with yahoo, you need to google for 'yahoo openid discovery url' which will return http://me.yahoo.com , this is all the change that you will be required to do in your script in case you want to authenticate with yahoo.&lt;br /&gt;&lt;br /&gt;So now once the user is authenticated google or yahoo will return to you a sea of information, you can find it in the address bar of the browser, most of which you may not be interested in, so I looked at the entire string(cryptic) and tried to look for the email address of the user, and.... it was not there, some more looking around and I found that you will have to explicitly ask the provider(google,yahoo) to send you the email address that was used for authentication, with the following line in your code.&lt;br /&gt;&lt;br /&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;$openid-&amp;gt;required = array('contact/email');&lt;/div&gt;&lt;br /&gt;To access this information, we can use the following lines of code&lt;br /&gt;&lt;br /&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;$array = $openid-&amp;gt;getAttributes();&lt;/div&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;echo array['contact/email']);&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3341953160726374446-2964435263450375774?l=samixblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://samixblog.blogspot.com/feeds/2964435263450375774/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://samixblog.blogspot.com/2011/11/authenticating-web-application-with.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3341953160726374446/posts/default/2964435263450375774'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3341953160726374446/posts/default/2964435263450375774'/><link rel='alternate' type='text/html' href='http://samixblog.blogspot.com/2011/11/authenticating-web-application-with.html' title='Authenticating web application with google and yahoo'/><author><name>samix</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3341953160726374446.post-4992173834234729157</id><published>2011-11-09T06:43:00.000-08:00</published><updated>2011-11-09T10:34:36.769-08:00</updated><title type='text'>OpenVZ and setting time and timezone</title><content type='html'>Changing the time on a linux system can be broken into two parts, one is to change the time and the other is to change the timezone.&lt;br /&gt;&lt;br /&gt;Recently we needed to change the timezone of all our OpenVZ containers to IST, this exersice involved changing the time and the timezone on the hardware node, and changing the timezone on the virtual containers,&amp;nbsp; this is because VM containers take the time from the hardware node itself, so on the virtual container you need to change just the timezone and not worry about changing the time.&lt;br /&gt;&lt;br /&gt;Changing time and timezone on the hardware node&lt;br /&gt;&lt;br /&gt;Remove the current timezone file &lt;br /&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;#rm -f /etc/localtime&lt;/div&gt;&lt;br /&gt;Link the new timezone file&lt;br /&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;#ln -s /usr/share/zoneinfo/Asia/Calcutta /etc/localtime&lt;/div&gt;&lt;br /&gt;Sync the date using ntpdate&lt;br /&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;#ntpdate 0.us.pool.ntp.org&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;Now, on the Virtual machines all we need to do is change the timezone&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;#rm -f /etc/localtime&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;#ln -s /usr/share/zoneinfo/Asia/Calcutta /etc/localtime&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: inherit;"&gt;In case the changes do not reflect in the container you may have to reboot it.&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;# vzctl restart 111&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;br /&gt;&lt;span style="font-family: inherit;"&gt;&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;Done.&lt;/span&gt; &lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3341953160726374446-4992173834234729157?l=samixblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://samixblog.blogspot.com/feeds/4992173834234729157/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://samixblog.blogspot.com/2011/11/openvz-and-setting-time-and-timezone.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3341953160726374446/posts/default/4992173834234729157'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3341953160726374446/posts/default/4992173834234729157'/><link rel='alternate' type='text/html' href='http://samixblog.blogspot.com/2011/11/openvz-and-setting-time-and-timezone.html' title='OpenVZ and setting time and timezone'/><author><name>samix</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3341953160726374446.post-4092080614467351503</id><published>2011-11-08T04:26:00.000-08:00</published><updated>2011-11-08T04:26:22.664-08:00</updated><title type='text'>Perl script to get client IP</title><content type='html'>Sometimes you need to know the IP address of the client machine that is connecting to your website.&amp;nbsp; There is a perl module CGI which can be used to accomplish this, there are two subroutines that can be used with slight different results&lt;br /&gt;&lt;br /&gt;CGI-&amp;gt;remote_addr - Returns the IP address of the client connecting.&lt;br /&gt;&lt;br /&gt;CGI-&amp;gt;remote_addr - Returns the A record of the client connecting, in case there is no A record the ip&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; address of the client will be returned.&lt;br /&gt;&lt;br /&gt;Perl code to implement can be found &lt;a href="https://github.com/samix119/Project-Code/blob/master/MyIP/ip.pl" target="_blank"&gt;here&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;You will need to put this script and enable your web server to run perl scripts. In case you use nginx &lt;a href="http://samixblog.blogspot.com/2011/11/executing-perl-php-and-cgi-scripts-with.html" target="_blank"&gt;here&lt;/a&gt; is how to do it.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3341953160726374446-4092080614467351503?l=samixblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://samixblog.blogspot.com/feeds/4092080614467351503/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://samixblog.blogspot.com/2011/11/perl-script-to-get-client-ip.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3341953160726374446/posts/default/4092080614467351503'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3341953160726374446/posts/default/4092080614467351503'/><link rel='alternate' type='text/html' href='http://samixblog.blogspot.com/2011/11/perl-script-to-get-client-ip.html' title='Perl script to get client IP'/><author><name>samix</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3341953160726374446.post-4335831109284376832</id><published>2011-11-06T10:09:00.000-08:00</published><updated>2011-11-06T11:49:43.424-08:00</updated><title type='text'>github and perl to manage openvz containers</title><content type='html'>This post &lt;a href="http://kartar.net/2011/11/why-am-i-a-tool-maker%3f/" target="_blank"&gt;here&lt;/a&gt; just inspired me to get a github account, it took me hardly minutes to set this up, indeed with every passing day, I am realizing the advantages of git and the fact that github can help me leverage them for professional advancement as well as helping the larger community makes it all the more sweet.&lt;br /&gt;&lt;br /&gt;I had just written some perl code for managing openvz containers and was prepared to share it with the larger opensource community, The code is too primitive in my view to bundle it as a perl module, I just wanted to share it as is, but was looking for a easy way to do this, github fits the bill, so here is the link to my brand new &lt;a href="https://github.com/samix119/Project-Code" target="_blank"&gt;github account&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Another thing is that I can always have versions of my code accessible from anywhere, no carrying around my code in USB sticks and flash drives when changing jobs, laptops, desktops... &lt;br /&gt;&lt;br /&gt;The pearl code a package can be found under the openvz directory, it basically consists of perl subs that do small tasks like starting, stopping, rebooting, listing openvz containers running on a hardware node.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3341953160726374446-4335831109284376832?l=samixblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://samixblog.blogspot.com/feeds/4335831109284376832/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://samixblog.blogspot.com/2011/11/github-and-perl-to-manage-openvz.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3341953160726374446/posts/default/4335831109284376832'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3341953160726374446/posts/default/4335831109284376832'/><link rel='alternate' type='text/html' href='http://samixblog.blogspot.com/2011/11/github-and-perl-to-manage-openvz.html' title='github and perl to manage openvz containers'/><author><name>samix</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3341953160726374446.post-4997306826259366789</id><published>2011-11-05T09:13:00.000-07:00</published><updated>2011-11-05T09:13:07.454-07:00</updated><title type='text'>Executing perl php and cgi scripts with nginx</title><content type='html'>I had to deal today with using nginx as a frontend for nagios, this involved execution of cgi scripts and php scripts.&lt;br /&gt;&lt;br /&gt;The point is that nginx does not have any inbuilt capability to execute external scripts, thus if you want to execute any external script you will have to run a wrapper for that script and then tell nginx to proxy the execute requests to that wrapper.&lt;br /&gt;&lt;br /&gt;The another thing that I noticed is that it seems you cannot use the same wrapper for php and perl, cgi. So I had to install two wrapper, one for php and another one for perl and cgi.&lt;br /&gt;&lt;br /&gt;To start this wrappers at boot time we will use spawn-cgi, note spawn-cgi is no wrapper it is just there to start, stop, restart the wrapper script.&lt;br /&gt;&lt;br /&gt;Lets begin with installing the spawn-cgi rpm&lt;br /&gt;&lt;blockquote class="tr_bq"&gt;&lt;i&gt;yum install spawn-cgi&lt;/i&gt;&lt;/blockquote&gt;Make sure that you have php-cgi command installed and working on your machine, which is actually a wrapper for php scripts.&lt;br /&gt;Now we need to install another wrapper for perl and cgi scripts , follow this excellent &lt;a href="http://www.howtoforge.com/serving-cgi-scripts-with-nginx-on-centos-6.0-p2"&gt;howto&lt;/a&gt; to install the fcgiwrap, skip the spawn-cgi part there, read that here below. fastwrap is the wrapper for perl and cgi scripts&lt;br /&gt;&lt;br /&gt;After we have installed these two wrappers, one for php and another one for perl and cgi scripts, we need init scripts to start these wrapper and manage them.&lt;br /&gt;&lt;br /&gt;we will create two init scripts spawn-fcgi and spawn-fcgi-php to manage the two wappers &lt;br /&gt;&lt;br /&gt;&lt;b&gt;1 - fastwrap&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Edit the /etc/sysconfig/spawn-fcgi file&lt;br /&gt;&lt;blockquote class="tr_bq"&gt;&lt;i&gt;FCGI_SOCKET=/var/run/fcgiwrap.socket&lt;/i&gt;&lt;br /&gt;&lt;i&gt;FCGI_PROGRAM=/usr/local/sbin/fcgiwrap&lt;/i&gt;&lt;br /&gt;&lt;i&gt;FCGI_USER=nginx&lt;/i&gt;&lt;br /&gt;&lt;i&gt;FCGI_GROUP=nginx&lt;/i&gt;&lt;br /&gt;&lt;i&gt;FCGI_EXTRA_OPTIONS="-M 0700"&lt;/i&gt;&lt;br /&gt;&lt;i&gt;OPTIONS="-u $FCGI_USER -g $FCGI_GROUP -s $FCGI_SOCKET -S $FCGI_EXTRA_OPTIONS -F 1 -P /var/run/spawn-fcgi.pid -- $FCGI_PROGRAM"&lt;/i&gt;&lt;/blockquote&gt;&lt;br /&gt;I am using a unix socket instead of a inet address, you can use the latter instead with the -p option, now start the wrapper&lt;br /&gt;&lt;blockquote class="tr_bq"&gt;&lt;i&gt;[11:55]:root@mis:vhosts:#:&amp;gt;/etc/init.d/spawn-fcgi start&lt;/i&gt;&lt;br /&gt;&lt;i&gt;Starting spawn-fcgi:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [&amp;nbsp; OK&amp;nbsp; ]&lt;/i&gt;&lt;br /&gt;&lt;i&gt;[11:56]:root@xxx:vhosts:#:&amp;gt;ps aux | grep cgi&lt;/i&gt;&lt;br /&gt;&lt;i&gt;nginx&amp;nbsp;&amp;nbsp;&amp;nbsp; 29732&amp;nbsp; 0.0&amp;nbsp; 0.0&amp;nbsp;&amp;nbsp; 8208&amp;nbsp;&amp;nbsp; 472 ?&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Ss&amp;nbsp;&amp;nbsp; 11:56&amp;nbsp;&amp;nbsp; 0:00 /usr/local/sbin/fcgiwrap&lt;/i&gt;&lt;br /&gt;&lt;i&gt;root&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 29745&amp;nbsp; 0.0&amp;nbsp; 0.0 103152&amp;nbsp;&amp;nbsp; 816 pts/2&amp;nbsp;&amp;nbsp;&amp;nbsp; S+&amp;nbsp;&amp;nbsp; 11:56&amp;nbsp;&amp;nbsp; 0:00 grep cgi&lt;/i&gt;&lt;br /&gt;&lt;i&gt;[11:56]:root@xxx:vhosts:#:&amp;gt;&lt;/i&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;b&gt;2 - php-cgi &lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Copy over the file /etc/sysconfig/spawn-cgi file and create another one named  /etc/sysconfig/spawn-cgi-php&lt;br /&gt;&lt;br /&gt;The contents of this spawn-cgi-php file should look like&lt;br /&gt;&lt;blockquote class="tr_bq"&gt;&lt;i&gt;&amp;nbsp; SOCKET=/var/run/php-fcgi.sock&lt;br /&gt;&amp;nbsp;OPTIONS="-u nginx -g nginx -s $SOCKET -S -M 0600 -C 32 -F 1 -P /var/run/spawn-fcgi-php.pid -- /usr/bin/php-cgi"&lt;/i&gt;&lt;/blockquote&gt;&lt;br /&gt;next, copy over /etc/init.d/spawn-fcgi file to /etc/init.d/spawn-fcgi-php, in this file look for the variable prog and config and change it to&lt;br /&gt;&lt;br /&gt;&lt;blockquote class="tr_bq"&gt;&lt;i&gt;prog="spawn-fcgi-php"&lt;/i&gt;&lt;br /&gt;&lt;i&gt;config="/etc/sysconfig/spawn-fcgi-php"&lt;/i&gt;&lt;/blockquote&gt;&lt;br /&gt;chmod the file 755 and add spawn-fcgi-php to chkconfig, so that the wrapper comes up on startup&lt;br /&gt;&lt;blockquote class="tr_bq"&gt;&lt;i&gt;[12:01]:root@xxx:vhosts:#:&amp;gt;chmod&amp;nbsp; 755 /etc/init.d/spawn-fcgi-php&lt;br /&gt;[12:01]:root@xxx:vhosts:#:&amp;gt;chkconfig&amp;nbsp; --add spawn-fcgi-php&lt;br /&gt;[12:01]:root@xxx:vhosts:#:&amp;gt;chkconfig spawn-fcgi-php on&lt;br /&gt;[12:01]:root@xxx:vhosts:#:&amp;gt;chkconfig spawn-fcgi on&lt;/i&gt;&lt;/blockquote&gt;Start the wrapper &lt;br /&gt;&lt;blockquote class="tr_bq"&gt;&lt;i&gt; &lt;/i&gt;&lt;br /&gt;&lt;i&gt;[12:03]:root@mis:vhosts:#:&amp;gt;/etc/init.d/spawn-fcgi-php start&lt;br /&gt;Starting spawn-fcgi-php:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [&amp;nbsp; OK&amp;nbsp; ]&lt;br /&gt;[12:03]:root@mis:vhosts:#:&amp;gt;ps aux | grep cgi&lt;br /&gt;nginx&amp;nbsp;&amp;nbsp;&amp;nbsp; 29732&amp;nbsp; 0.0&amp;nbsp; 0.0&amp;nbsp;&amp;nbsp; 8208&amp;nbsp;&amp;nbsp; 472 ?&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Ss&amp;nbsp;&amp;nbsp; 11:55&amp;nbsp;&amp;nbsp; 0:00 /usr/local/sbin/fcgiwrap&lt;br /&gt;nginx&amp;nbsp;&amp;nbsp;&amp;nbsp; 31110&amp;nbsp; 0.2&amp;nbsp; 0.2 209192&amp;nbsp; 5888 ?&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Ss&amp;nbsp;&amp;nbsp; 12:03&amp;nbsp;&amp;nbsp; 0:00 /usr/bin/php-cgi&lt;br /&gt;nginx&amp;nbsp;&amp;nbsp;&amp;nbsp; 31111&amp;nbsp; 0.0&amp;nbsp; 0.1 209192&amp;nbsp; 2540 ?&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; S&amp;nbsp;&amp;nbsp;&amp;nbsp; 12:03&amp;nbsp;&amp;nbsp; 0:00 /usr/bin/php-cgi&lt;br /&gt;nginx&amp;nbsp;&amp;nbsp;&amp;nbsp; 31112&amp;nbsp; 0.0&amp;nbsp; 0.1 209192&amp;nbsp; 2540 ?&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; S&amp;nbsp;&amp;nbsp;&amp;nbsp; 12:03&amp;nbsp;&amp;nbsp; 0:00 /usr/bin/php-cgi&lt;br /&gt;nginx&amp;nbsp;&amp;nbsp;&amp;nbsp; 31113&amp;nbsp; 0.0&amp;nbsp; 0.1 209192&amp;nbsp; 2540 ?&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; S&amp;nbsp;&amp;nbsp;&amp;nbsp; 12:03&amp;nbsp;&amp;nbsp; 0:00 /usr/bin/php-cgi&lt;br /&gt;nginx&amp;nbsp;&amp;nbsp;&amp;nbsp; 31114&amp;nbsp; 0.0&amp;nbsp; 0.1 209192&amp;nbsp; 2540 ?&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; S&amp;nbsp;&amp;nbsp;&amp;nbsp; 12:03&amp;nbsp;&amp;nbsp; 0:00 /usr/bin/php-cgi&lt;br /&gt;nginx&amp;nbsp;&amp;nbsp;&amp;nbsp; 31115&amp;nbsp; 0.0&amp;nbsp; 0.1 209192&amp;nbsp; 2540 ?&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; S&amp;nbsp;&amp;nbsp;&amp;nbsp; 12:03&amp;nbsp;&amp;nbsp; 0:00 /usr/bin/php-cgi&lt;br /&gt;nginx&amp;nbsp;&amp;nbsp;&amp;nbsp; 31116&amp;nbsp; 0.0&amp;nbsp; 0.1 209192&amp;nbsp; 2540 ?&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; S&amp;nbsp;&amp;nbsp;&amp;nbsp; 12:03&amp;nbsp;&amp;nbsp; 0:00 /usr/bin/php-cgi&lt;/i&gt;&lt;br /&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/blockquote&gt;Now onto testing stuff, here is a simple nginx vhost file&lt;br /&gt;&lt;blockquote class="tr_bq"&gt;&lt;i&gt;server {&lt;/i&gt;&lt;br /&gt;&lt;i&gt;&amp;nbsp;&amp;nbsp; listen 80;&lt;br /&gt;&amp;nbsp;&amp;nbsp; server_name yourserver.com;&lt;br /&gt;&amp;nbsp;&lt;/i&gt;&lt;/blockquote&gt;&lt;blockquote&gt;&lt;i&gt;&amp;nbsp;&amp;nbsp; access_log&amp;nbsp; /var/log/nginx/yourserver.access.log;&lt;br /&gt;&amp;nbsp;&amp;nbsp; error_log&amp;nbsp;&amp;nbsp; /var/log/nginx/yourserver.error.log;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp; root&amp;nbsp;&amp;nbsp;&amp;nbsp; /var/www/html/manage;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp; location ~ \.php$ {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; include /etc/nginx/fastcgi.conf;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fastcgi_pass unix:/var/run/php-fcgi.sock;&lt;br /&gt;&amp;nbsp; }&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp; location ~ \.pl$ {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; include /etc/nginx/fastcgi.conf;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fastcgi_pass unix:/var/run/fcgiwrap.socket;&lt;br /&gt;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp; location ~ \.cgi$ {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; include /etc/nginx/fastcgi.conf;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fastcgi_pass unix:/var/run/fcgiwrap.socket;&lt;br /&gt;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&lt;br /&gt;}&lt;/i&gt;&lt;/blockquote&gt;Now, you can call your scripts like http://yourserver.com/test.pl or http://yourserver.com/test.php&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3341953160726374446-4997306826259366789?l=samixblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://samixblog.blogspot.com/feeds/4997306826259366789/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://samixblog.blogspot.com/2011/11/executing-perl-php-and-cgi-scripts-with.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3341953160726374446/posts/default/4997306826259366789'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3341953160726374446/posts/default/4997306826259366789'/><link rel='alternate' type='text/html' href='http://samixblog.blogspot.com/2011/11/executing-perl-php-and-cgi-scripts-with.html' title='Executing perl php and cgi scripts with nginx'/><author><name>samix</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3341953160726374446.post-3713708634437067754</id><published>2011-11-04T13:52:00.000-07:00</published><updated>2011-11-04T13:52:26.686-07:00</updated><title type='text'>postfix-2.8 RPM creation from SRPM errors</title><content type='html'>I downloaded postfix-2.8.6-1.fc15.src.rpm SRPM from the fedora repo onto my centos 5.6 box, I encountered a number of errors in trying to recompile the SRPM as documented below.&lt;br /&gt;&lt;br /&gt;First off, I was unable to install the SRPM due to the following error&lt;br /&gt;&lt;blockquote class="tr_bq"&gt; &lt;span style="font-size: x-small;"&gt;&lt;i&gt;&lt;span style="font-size: small;"&gt;[root@relay32 SRPMS]# rpm -ivh postfix-2.8.6-1.fc15.src.rpm&lt;br /&gt;warning: postfix-2.8.6-1.fc15.src.rpm: Header V3 RSA/SHA256 signature: NOKEY, key ID 069c8460&lt;br /&gt;&amp;nbsp;&amp;nbsp; 1:postfix&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; warning: user mockbuild does not exist - using root&lt;br /&gt;warning: group mockbuild does not exist - using root&lt;br /&gt;########################################### [100%]&lt;br /&gt;error: unpacking of archive failed on file /usr/src/redhat/SOURCES/README-Postfix-SASL-RedHat.txt;4eb44cae: cpio: MD5 sum mismatch&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/blockquote&gt;This is because I think FC15 uses &lt;a href="http://docs.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/6/html/Deployment_Guide/sec-Creating_a_Yum_Repository.html"&gt;XZ lossless data compression&lt;/a&gt;, and may also be signed using alternative (and stronger) hash algorithms such as SHA-256.&lt;br /&gt;&lt;br /&gt;Nonetheless, the workaround here is to use --nomd5 when installing the srpm.&lt;br /&gt;&lt;blockquote class="tr_bq"&gt;&lt;i&gt;[root@relay32 SRPMS]# rpm -ivh postfix-2.8.6-1.fc15.src.rpm&amp;nbsp; --nomd5&lt;br /&gt;warning: postfix-2.8.6-1.fc15.src.rpm: Header V3 RSA/SHA256 signature: NOKEY, key ID 069c8460&lt;/i&gt;&lt;/blockquote&gt;&lt;blockquote&gt;&lt;i&gt;1:postfix&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ########################################### [100%]&lt;/i&gt;&lt;/blockquote&gt;On trying to recreate the rpm I got the following error&lt;br /&gt;&lt;blockquote class="tr_bq"&gt;&lt;i&gt;[root@relay32 SPECS]# rpmbuild&amp;nbsp; -ba postfix.spec&lt;/i&gt;&lt;br /&gt;&lt;i&gt;error: Failed build dependencies&lt;/i&gt;&lt;br /&gt;&lt;i&gt;libdb-devel is needed by postfix-2.8.6-1.x86_64&lt;/i&gt;&lt;/blockquote&gt;I tried to google around for this rpm, but could not find anything, some more digging around the web, I found that the rpm that was missing was db4-devel on my setup, and the postfix.spec file was referring to that package as libdb-devel, so I edited the BuildRequires line in the spec file&lt;br /&gt;&lt;blockquote class="tr_bq"&gt;&lt;i&gt;BuildRequires: db4-devel, pkgconfig, zlib-devel&lt;/i&gt; &lt;/blockquote&gt;Post, these changes the rpmbuild went ahead fine and I had my rpm tucked in the RPMS/x86_64 directory.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3341953160726374446-3713708634437067754?l=samixblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://samixblog.blogspot.com/feeds/3713708634437067754/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://samixblog.blogspot.com/2011/11/postfix-28-rpm-creation-from-srpm.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3341953160726374446/posts/default/3713708634437067754'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3341953160726374446/posts/default/3713708634437067754'/><link rel='alternate' type='text/html' href='http://samixblog.blogspot.com/2011/11/postfix-28-rpm-creation-from-srpm.html' title='postfix-2.8 RPM creation from SRPM errors'/><author><name>samix</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3341953160726374446.post-9015376085453612230</id><published>2011-11-02T11:53:00.000-07:00</published><updated>2011-12-22T04:35:37.306-08:00</updated><title type='text'>yum [Errno -3] Error performing checksum</title><content type='html'>EDIT: One of my friends naresh has worked recently on this problem, refer to his blog &lt;a href="http://nareshov.wordpress.com/2011/12/22/rpmbuild-behaviour-centos5-vs-centos6/" target="_blank"&gt;here&lt;/a&gt; &lt;br /&gt;&lt;br /&gt;I created a postfix rpm today and then created a yum repository to serve it, but whenever I would try to install this rpm from one of my client servers, I would get the&amp;nbsp; error below&lt;br /&gt;&lt;blockquote class="tr_bq"&gt;&lt;i&gt;&lt;span style="font-size: x-small;"&gt;[root@server yum]# yum list postfix&lt;br /&gt;Loaded plugins: fastestmirror&lt;br /&gt;Loading mirror speeds from cached hostfile&lt;br /&gt;&amp;nbsp;* base: centos.kiewel-online.ch&lt;br /&gt;&amp;nbsp;* epel: ftp.uni-koeln.de&lt;br /&gt;&amp;nbsp;* extras: centos.kiewel-online.ch&lt;br /&gt;&amp;nbsp;* rpmforge: fr2.rpmfind.net&lt;br /&gt;&amp;nbsp;* updates: centos.kiewel-online.ch&lt;br /&gt;my &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; | 2.6 kB&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 00:00&lt;br /&gt;my/primary_db&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; | 4.6 kB&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 00:00&lt;br /&gt;http://server/repo/RPMS/x86_64/base/repodata/primary.sqlite.bz2: [Errno -3] Error performing checksum&lt;br /&gt;Trying other mirror.&lt;br /&gt;viva/primary_db&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; | 4.6 kB&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 00:00&lt;br /&gt;http://server/repo/RPMS/x86_64/base/repodata/primary.sqlite.bz2: [Errno -3] Error performing checksum&lt;br /&gt;Trying other mirror.&lt;br /&gt;Error: failure: repodata/primary.sqlite.bz2 from my: [Errno 256] No more mirrors to try.&lt;/span&gt;&lt;/i&gt;&lt;/blockquote&gt;Google did not turn up too many helpful links, digging deeper in some Redhat docs, I found this&lt;br /&gt;&lt;blockquote class="tr_bq"&gt;&lt;i&gt;Because RPM packages for Red Hat Enterprise Linux 6 are compressed using  the XZ lossless data compression format, and may also be signed using  alternative (and stronger) hash algorithms such as SHA-256, it is not  possible to run &lt;code class="command"&gt;createrepo&lt;/code&gt; on Red Hat Enterprise Linux 5 to create the package metadata for Red Hat Enterprise Linux 6 packages. The &lt;code class="command"&gt;createrepo&lt;/code&gt; command relies on &lt;code class="command"&gt;rpm&lt;/code&gt; to open and inspect the packages, and &lt;code class="command"&gt;rpm&lt;/code&gt; on Red Hat Enterprise Linux 5 is not able to open the improved Red Hat Enterprise Linux 6 RPM package format.&lt;/i&gt;       &lt;/blockquote&gt;I then realized that I had created the rpm on Centos-5 and was creating the repo on a server running Centos-6, to see if that was the problem, I quickly created a test repo on a Centos-5 server and things worked as expected.&lt;br /&gt;&lt;br /&gt;Another change in Centos-6 from Centos-5 is the location where one builds the rpm, the good old /usr/src/redhat is now extinct,&amp;nbsp; now with Centos-6 the current location is /root/rpmbuild.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3341953160726374446-9015376085453612230?l=samixblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://samixblog.blogspot.com/feeds/9015376085453612230/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://samixblog.blogspot.com/2011/11/yum-errno-3-error-performing-checksum.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3341953160726374446/posts/default/9015376085453612230'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3341953160726374446/posts/default/9015376085453612230'/><link rel='alternate' type='text/html' href='http://samixblog.blogspot.com/2011/11/yum-errno-3-error-performing-checksum.html' title='yum [Errno -3] Error performing checksum'/><author><name>samix</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3341953160726374446.post-1435750687201564867</id><published>2011-11-01T23:12:00.000-07:00</published><updated>2011-11-01T23:12:50.780-07:00</updated><title type='text'>On not checking root mails and lost backups</title><content type='html'>Not checking root mails is a bad habit, it's like not listening to your body(server).&lt;br /&gt;&lt;br /&gt;Because of an incorrect script name in the crontab, my database backups were not running for the past 20 days or so, and, because I was not checking root mails, I could not be informed in time.&lt;br /&gt;&lt;br /&gt;Somehow, Thank God, today I 'happped' to type the mail command and see all the crontab mails lying around, and fixed the problem.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3341953160726374446-1435750687201564867?l=samixblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://samixblog.blogspot.com/feeds/1435750687201564867/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://samixblog.blogspot.com/2011/11/on-not-checking-root-mails-and-lost.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3341953160726374446/posts/default/1435750687201564867'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3341953160726374446/posts/default/1435750687201564867'/><link rel='alternate' type='text/html' href='http://samixblog.blogspot.com/2011/11/on-not-checking-root-mails-and-lost.html' title='On not checking root mails and lost backups'/><author><name>samix</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3341953160726374446.post-3992924080579878024</id><published>2011-11-01T00:23:00.000-07:00</published><updated>2011-11-01T00:23:09.414-07:00</updated><title type='text'>Cron job in Cron.d fails to run</title><content type='html'>I came across a weird situation today where I Installed a cron file in the /etc/cron.d directory to run every 5 minutes, the cron was supposed to be run as a non-root user. The problem was that the cron was just not running, neither was there any mail to root, nor any indication the /var/log/cron file that the cron could not be run due to some errors.&lt;br /&gt;&lt;br /&gt;A quick google and I got the feeling that crond is unaware of the existence of the cron, hastily to fix the problem I did a crond restart and my cron started to run again, but I should have first tested with a reload.&lt;br /&gt;&lt;br /&gt;I tried to reproduce this by putting another cron in /etc/cron.d file, but it started to execute without any problems.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3341953160726374446-3992924080579878024?l=samixblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://samixblog.blogspot.com/feeds/3992924080579878024/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://samixblog.blogspot.com/2011/11/cron-job-in-crond-fails-to-run.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3341953160726374446/posts/default/3992924080579878024'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3341953160726374446/posts/default/3992924080579878024'/><link rel='alternate' type='text/html' href='http://samixblog.blogspot.com/2011/11/cron-job-in-crond-fails-to-run.html' title='Cron job in Cron.d fails to run'/><author><name>samix</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3341953160726374446.post-8133285996988476166</id><published>2011-10-29T06:11:00.000-07:00</published><updated>2011-10-29T06:38:31.398-07:00</updated><title type='text'>GIT repo for Puppet howto</title><content type='html'>This is a easy howto to set up a git repo(local) for puppet, complete with some interesting hooks&lt;br /&gt;&lt;br /&gt;# Initialize the repo&lt;br /&gt;&lt;blockquote class="tr_bq"&gt;mkdir /var/git/puppet&lt;br /&gt;cd /var/git/puppet&lt;br /&gt;git --bare init&lt;/blockquote&gt;# next set up the working directory for puppet&lt;br /&gt;&lt;blockquote class="tr_bq"&gt;mkdir /etc/puppet&lt;br /&gt;cd /etc/puppet&lt;br /&gt;git init&lt;br /&gt;git remote add origin file:///var/git/puppet/&lt;/blockquote&gt;# make some changes in the ~/.gitconfig file&lt;br /&gt;&lt;blockquote class="tr_bq"&gt;[remote "origin"]&lt;br /&gt;&amp;nbsp; url = file:///var/git/puppet&lt;br /&gt;&amp;nbsp; fetch = +refs/heads/*:refs/remotes/origin/*&lt;br /&gt;&lt;br /&gt;[branch "master"]&lt;br /&gt;&amp;nbsp; remote = origin&lt;br /&gt;&amp;nbsp; merge = refs/heads/master&lt;/blockquote&gt;&amp;nbsp;# Initialize the repo by adding a file&lt;br /&gt;&lt;blockquote class="tr_bq"&gt;touch a&lt;br /&gt;git add a&lt;br /&gt;git commit -m "Bismillah, initialize"&lt;br /&gt;git push origin master&lt;/blockquote&gt;# Now set email notification on when users push changes to the repo&lt;br /&gt;&lt;blockquote class="tr_bq"&gt;vi /var/git/puppet/config&lt;br /&gt;[core]&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; repositoryformatversion = 0&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; filemode = true&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; bare = true&lt;br /&gt;&lt;br /&gt;[hooks]&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mailinglist = sysad@madinix.com&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; showrev = "git show -C %s; echo"&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; emailprefix = "[viva puppet] "&lt;/blockquote&gt;# Initialize the email script by changing the name of the hook from post-receive.sample to post-receive&amp;nbsp; &lt;br /&gt;&lt;blockquote class="tr_bq"&gt;&amp;nbsp;cd /var/git/puppet/hooks&lt;br /&gt;mv post-receive.sample post-receive&lt;/blockquote&gt;# Uncomment the line that sends mail in the file post-receive&lt;br /&gt;&lt;blockquote class="tr_bq"&gt;. /usr/share/git-core/contrib/hooks/post-receive-email &lt;/blockquote&gt;Now, whenever someone does a push, an email with the details of the push will be sent to the email address sysad@madinix.com. Multiple email addresses can be supplied, seperated with ',' &lt;br /&gt;&lt;br /&gt;# There is another thing that I want to do when users push to the repo, the working directory should get updated on each push, thus we use this script and add it to the post-receive hook file&lt;br /&gt;&lt;blockquote class="tr_bq"&gt;vi /usr/share/git-core/contrib/hooks/post-receive-pull&lt;br /&gt;&lt;br /&gt;#!/bin/sh&lt;br /&gt;&lt;br /&gt;cd /etc/puppet || exit&lt;br /&gt;env -i git pull origin master&lt;/blockquote&gt;# Add this script path to /var/git/puppet/hooks/post-receive, so now whenever someone pushes the changes to the repo, a mail will be sent to the email addresses defined in the config file as well as a pull will be initiated from the working directory /etc/puppet&lt;br /&gt;&lt;br /&gt;# Next you need to give write perms for the users who will be issuing 'git push' to the working directory as well as the repo, my favorite way is setfacl&lt;br /&gt;&lt;blockquote class="tr_bq"&gt;setfact -Rm user:sameer:rwx /etc/puppet&lt;br /&gt;setfact -Rm user:sameer:rwx /var/git/puppet&lt;/blockquote&gt;# Cloning the repo for the contributor sameer &lt;br /&gt;&lt;blockquote class="tr_bq"&gt;su - sameer&lt;br /&gt;git clone file:///var/git/puppet&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3341953160726374446-8133285996988476166?l=samixblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://samixblog.blogspot.com/feeds/8133285996988476166/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://samixblog.blogspot.com/2011/10/git-repo-for-puppet-howto.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3341953160726374446/posts/default/8133285996988476166'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3341953160726374446/posts/default/8133285996988476166'/><link rel='alternate' type='text/html' href='http://samixblog.blogspot.com/2011/10/git-repo-for-puppet-howto.html' title='GIT repo for Puppet howto'/><author><name>samix</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3341953160726374446.post-4894917747564971694</id><published>2011-10-18T22:57:00.000-07:00</published><updated>2011-10-18T22:58:13.220-07:00</updated><title type='text'>Grep wont work</title><content type='html'>This morning I had to write some scripts, I was just running some sample commands to test the proof of concept&lt;br /&gt;&lt;blockquote&gt;&lt;i&gt;[06:45]:root@CentOS-56-64-minimal:~:#:&amp;gt;&lt;/i&gt;&lt;i&gt;postcat -q 4BFDD18C1A9&lt;/i&gt;&lt;br /&gt;&lt;i&gt;*** ENVELOPE RECORDS maildrop/0BF2118C031 ***&lt;/i&gt;&lt;br /&gt;&lt;i&gt;message_arrival_time: Wed Oct 19 06:44:53 2011&lt;/i&gt;&lt;br /&gt;&lt;i&gt;named_attribute: rewrite_context=local&lt;/i&gt;&lt;br /&gt;&lt;i&gt;sender_fullname: root&lt;/i&gt;&lt;br /&gt;&lt;i&gt;sender: root&lt;/i&gt;&lt;br /&gt;&lt;i&gt;recipient: samix_119@yahoo.com&lt;/i&gt;&lt;br /&gt;&lt;i&gt;*** MESSAGE CONTENTS maildrop/0BF2118C031 ***&lt;/i&gt;&lt;br /&gt;&lt;i&gt;To: samix_119@yahoo.com&lt;/i&gt;&lt;br /&gt;&lt;i&gt;Subject: test&lt;/i&gt;&lt;/blockquote&gt;Then&amp;nbsp; I tried to grep the subject line from the output, but grep wont return anything.&lt;br /&gt;&lt;blockquote&gt;&lt;i&gt;[07:52]:root@CentOS-56-64-minimal:~:#:&amp;gt;postcat -q 4BFDD18C1A9 | grep subject&lt;br /&gt;[07:52]:root@CentOS-56-64-minimal:~:#:&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/i&gt;&lt;/blockquote&gt;I tried to then grep the output of ls, no avail, I then tried to see if grep is really grep, and bam I found the problem&lt;br /&gt;&lt;blockquote&gt;&lt;i&gt;[07:52]:root@CentOS-56-64-minimal:~:#:&amp;gt; file /bin/grep&lt;/i&gt;&lt;br /&gt;&lt;i&gt;/bin/grep: Empty File&lt;/i&gt;&lt;/blockquote&gt;It seems that somone inadvertatnly over-wrote the /bin/grep file and caused this unlikely bug, I just uninstalled and reinstalled the grep rpm to fix this problem.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3341953160726374446-4894917747564971694?l=samixblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://samixblog.blogspot.com/feeds/4894917747564971694/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://samixblog.blogspot.com/2011/10/grep-wont-work.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3341953160726374446/posts/default/4894917747564971694'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3341953160726374446/posts/default/4894917747564971694'/><link rel='alternate' type='text/html' href='http://samixblog.blogspot.com/2011/10/grep-wont-work.html' title='Grep wont work'/><author><name>samix</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3341953160726374446.post-723835973063724089</id><published>2011-06-28T23:22:00.000-07:00</published><updated>2011-06-28T23:23:49.118-07:00</updated><title type='text'>Yahoo Dictact - Don't switch back</title><content type='html'>Yahoo seems to be acting as a medivial, despotic war lord, Inspite of the new mail UI being buggy, yahoo has disabled switching back to the good old classic format, nice way to kill your buisness and drive people to gmail.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3341953160726374446-723835973063724089?l=samixblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://samixblog.blogspot.com/feeds/723835973063724089/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://samixblog.blogspot.com/2011/06/yahoo-dictact-dont-switch-back.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3341953160726374446/posts/default/723835973063724089'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3341953160726374446/posts/default/723835973063724089'/><link rel='alternate' type='text/html' href='http://samixblog.blogspot.com/2011/06/yahoo-dictact-dont-switch-back.html' title='Yahoo Dictact - Don&apos;t switch back'/><author><name>samix</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3341953160726374446.post-8764637428620503646</id><published>2011-06-16T03:04:00.000-07:00</published><updated>2011-06-16T03:05:51.516-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='wget'/><category scheme='http://www.blogger.com/atom/ns#' term='extentions'/><category scheme='http://www.blogger.com/atom/ns#' term='delay'/><title type='text'>Powerful wget Options</title><content type='html'>Often while downloading stuff via wget, firewalls and other abuse detection software block the IP becuase wget has caused a lot of load on the server.&lt;br /&gt;&lt;br /&gt;Using wget and being a good netizen go hand in hand, when using wget you can use the --wait option to specify the time between two hits thereby reducing the load caused on the server&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;wget http://link_to_the_site.com --wait=10 --recursive&lt;/span&gt;&lt;/blockquote&gt;&lt;br /&gt;To save on bandwidth you can also specify the type of file that you want to do download, or the type of file you do not want to download&lt;br /&gt;&lt;br /&gt;-R sets the file extenstions that you do not want to download and -A sets the file extentions that you want to download, so&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;wget http://link_to_the_site.com --wait=10 --recursive -A html,php,xml&lt;/div&gt;&lt;br /&gt;&lt;i&gt;-A html,php,xml - will only download files that end with html,php,xml&amp;nbsp;&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;wget http://link_to_the_site.com --wait=10 --recursive -R png,mp3,wav&lt;/div&gt;&lt;/blockquote&gt;&lt;blockquote&gt;&lt;i&gt;-R png,mp3,wav - will not download any files that end with these extentions&lt;/i&gt;&lt;/blockquote&gt;&amp;nbsp;This can help you save on bandwidth and also avoid downloading useless files. &lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3341953160726374446-8764637428620503646?l=samixblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://samixblog.blogspot.com/feeds/8764637428620503646/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://samixblog.blogspot.com/2011/06/powerful-wget-options.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3341953160726374446/posts/default/8764637428620503646'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3341953160726374446/posts/default/8764637428620503646'/><link rel='alternate' type='text/html' href='http://samixblog.blogspot.com/2011/06/powerful-wget-options.html' title='Powerful wget Options'/><author><name>samix</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3341953160726374446.post-3417016585778378470</id><published>2011-06-13T03:03:00.000-07:00</published><updated>2011-06-13T03:05:00.161-07:00</updated><title type='text'>Useless crontab mails for tar</title><content type='html'>If you have ever used tar in a script or directly as a crontab command you may have got crontab mails each time tar ran with the following text&lt;br /&gt;&lt;blockquote style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;tar: Removing leading `/' from member names&lt;/span&gt;&lt;/blockquote&gt;Though the excersise, ie removing the leading '/' is indeed good and wanted, the mails that cron sends in every morning are indeed irritating, what to do ?&lt;br /&gt;&lt;br /&gt;A quick google seach and helpful comments came up with the -C switch, so the command&lt;br /&gt;&lt;blockquote&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;tar -cvf archive.tar /application/repo/data_dir&lt;/span&gt;&lt;/div&gt;&lt;/blockquote&gt;becomes,&lt;br /&gt;&lt;blockquote style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;tar -cvf archive.tar -C /application/repo data_dir&lt;/blockquote&gt;-C causes tar to first switch root and go to directory&amp;nbsp; &lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;/application/repo data_dir, &lt;/span&gt;leaving no need to remove any leading slashes (/)&lt;br /&gt;&lt;br /&gt;Precedence of the -C switch before the names of the file or directory to be tar'ed matters, the following invocation is incorrect and tar will error out &lt;br /&gt;&lt;blockquote style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;div&gt;&lt;span style="font-size: small;"&gt;tar -cvf archive.tar data_dir -C /application/repo&lt;/span&gt;&lt;/div&gt;&lt;/blockquote&gt;&lt;blockquote style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;tar: data_dir: Cannot stat: No such file or directory&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt; tar: Error exit delayed from previous errors&lt;/span&gt;&lt;/blockquote&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;/div&gt;The correct invocation would be&lt;br /&gt;&lt;blockquote&gt;&amp;nbsp;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;tar -cvf archive.tar -C /application/repo data_dir &lt;/span&gt;&lt;/blockquote&gt;&amp;nbsp;There you go, no more useless mails from cron.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3341953160726374446-3417016585778378470?l=samixblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://samixblog.blogspot.com/feeds/3417016585778378470/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://samixblog.blogspot.com/2011/06/useless-crontab-mails-for-tar.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3341953160726374446/posts/default/3417016585778378470'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3341953160726374446/posts/default/3417016585778378470'/><link rel='alternate' type='text/html' href='http://samixblog.blogspot.com/2011/06/useless-crontab-mails-for-tar.html' title='Useless crontab mails for tar'/><author><name>samix</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3341953160726374446.post-5407875070646788645</id><published>2011-06-01T05:05:00.000-07:00</published><updated>2011-06-01T05:05:54.870-07:00</updated><title type='text'>How to use lock files</title><content type='html'>Many a time you may want to launch an instance of a script if no other instance of the same script is currently running, I have seen many sysadmin friends use a lock file for this purpose because a lock file is kind of cool.&lt;br /&gt;&lt;br /&gt;I have observed many faulty approches to using lock files. Generally when using lock files, simple callous scripts work like this&lt;br /&gt;&lt;blockquote style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;if [ ! -e $lockfile ]&lt;br /&gt;then&lt;br /&gt;&amp;nbsp;&amp;nbsp; touch $lockfile&lt;br /&gt;&amp;nbsp;&amp;nbsp; do_something&lt;br /&gt;&amp;nbsp;&amp;nbsp; rm $lockfile&lt;br /&gt;else&lt;br /&gt;&amp;nbsp;&amp;nbsp; #already running&lt;br /&gt;&amp;nbsp;&amp;nbsp; exit&lt;br /&gt;fi&lt;/blockquote&gt;One of the places that this simple mechanism will fail is if the script after the function do_something is unable to delete the lock file for some reason, due to this every time the next instance of the script initiates it will just exit expecting that one instance is already running. &lt;br /&gt;&lt;br /&gt;This can be overcome by storing the PID of the script in the lockfile and then checking if the same PID exists in the process list, the above script can become something like&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;if [ ! -e $lockfile ]&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;then&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp; echo $$ &amp;gt; $lockfile &lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp; do_something&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp; rm $lockfile&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;elif [ ps aux | grep `cat $lockfile` ]&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp; #one instance already active&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp; exit&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;else&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp; #lockfile is stale&amp;nbsp;&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp; rm $lockfile&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp; echo $$ &amp;gt; $lockfile &lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp; do_something&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp; rm $lockfile&lt;/div&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;fi&lt;/span&gt;&lt;br /&gt;&lt;/blockquote&gt;&amp;nbsp;There are alternatives to figure out if the script is already running without using the lock file, this can be done by grepping the name of the script in the output of the ps command without any need for any additional file touching and set up.&lt;br /&gt;&lt;br /&gt;&lt;blockquote style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;if [ ! ps aux | grep -q [n]ame_of_script ]&lt;br /&gt;then&lt;br /&gt;&amp;nbsp;&amp;nbsp; do_something&lt;br /&gt;else&lt;br /&gt;#exit, already running&lt;br /&gt;&amp;nbsp; exit&lt;br /&gt;fi&lt;/blockquote&gt;Short and simple though maybe less reliable&lt;br /&gt;&lt;blockquote&gt;&lt;blockquote&gt;&lt;blockquote style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;/blockquote&gt;&lt;/blockquote&gt;&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3341953160726374446-5407875070646788645?l=samixblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://samixblog.blogspot.com/feeds/5407875070646788645/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://samixblog.blogspot.com/2011/06/how-to-use-lock-files.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3341953160726374446/posts/default/5407875070646788645'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3341953160726374446/posts/default/5407875070646788645'/><link rel='alternate' type='text/html' href='http://samixblog.blogspot.com/2011/06/how-to-use-lock-files.html' title='How to use lock files'/><author><name>samix</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3341953160726374446.post-8073775850722064246</id><published>2011-05-30T06:44:00.000-07:00</published><updated>2011-05-30T07:18:44.151-07:00</updated><title type='text'>What is this SPF anyways ?</title><content type='html'>Simple, let us assume that you are the owner of the domain myprivatedomain.com and have recently noticed that some spammer is using your domain name to send spam emails. What are your options ?&lt;br /&gt;&lt;br /&gt;Of cource you cannot  stop the spammer from using your domain name more than you can stop him  from using his own domain name, right ? this is where SPF steps in, if  there was a way for you to publish to the world that you only send out  emails from IPs 1.1.1.1 and 2.2.2.2 then you will be able to expose the spammer for what they are. An Imposter.&lt;br /&gt;&lt;br /&gt;This can be done by publishing a&amp;nbsp;&lt;a href="http://www.openspf.org/DNS"&gt;DNS TXT&lt;/a&gt; record or a&amp;nbsp;&lt;a href="http://www.openspf.org/DNS"&gt;DNS SPF&lt;/a&gt; record(if supported by the nameserver) where you specify the IP's through which you send emails for your domain, so basically you will associate the IP's of your outbound mail servers with your domain name and publish this association for all to see and decide.&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ---------------- 1.1.1.1&lt;br /&gt;myprivatedomain.com ----------|&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ---------------- 2.2.2.2&lt;/blockquote&gt;In the above simple diagram I have associated two IP's 1.1.1.1 and 2.2.2.2 with the domain name myprivatedomain.com, this information will be available to any mail server that implements a SPF checking policy and depending upon the check the server can instantly figure weather the mail has been generated by your server or through a malicious spammer, That's SPF for you.&lt;br /&gt;&lt;br /&gt;I have deliberately left out the technical parts and explanations as they abound on the internet.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3341953160726374446-8073775850722064246?l=samixblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://samixblog.blogspot.com/feeds/8073775850722064246/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://samixblog.blogspot.com/2011/05/what-is-this-spf-anyways.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3341953160726374446/posts/default/8073775850722064246'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3341953160726374446/posts/default/8073775850722064246'/><link rel='alternate' type='text/html' href='http://samixblog.blogspot.com/2011/05/what-is-this-spf-anyways.html' title='What is this SPF anyways ?'/><author><name>samix</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3341953160726374446.post-1288214663524117592</id><published>2011-05-15T01:02:00.000-07:00</published><updated>2011-05-15T01:05:48.386-07:00</updated><title type='text'>SAMBA File Sharing - I</title><content type='html'>Recently I was required to setup file sharing for our users, naturally the users are all on windows and we wanted a Linux back end, so what better than SAMBA ?&lt;br /&gt;&lt;br /&gt;But we wanted a lot more features like : &lt;br /&gt;&lt;ul&gt;&lt;li&gt;Exposing the home directory of each user via SAMBA&lt;/li&gt;&lt;li&gt;Exposing a public_html directory for each user over the web&lt;/li&gt;&lt;li&gt;Exposing the SAMBA shares via the web but with authentication. &lt;/li&gt;&lt;li&gt;An integrated web interface for users to manage their passwords, reset etc&lt;/li&gt;&lt;li&gt;Audit user actions when they access the share via SAMBA&lt;/li&gt;&lt;li&gt;Scripts to add user, edit and delete them&amp;nbsp;&lt;/li&gt;&lt;li&gt;And of course puppetizing the entire setup &lt;/li&gt;&lt;/ul&gt;Well, let us begin with setting up the SAMBA shares first in this post, the reqiured SAMBA rpms are&lt;br /&gt;&lt;br /&gt;&lt;blockquote style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;samba-client&lt;br /&gt;samba-common&lt;br /&gt;samba&lt;/blockquote&gt;Next, the conf file&lt;br /&gt;&lt;blockquote style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;[global]&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; workgroup = COMPANY&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; server string = COMPANY&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; invalid users = root bin daemon nobody named sys tty disk mem kmem users&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; encrypt passwords = yes&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; syslog only = yes&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; syslog = 2&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; log level = 2&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; printing = bsd&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;[DEPT1]&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; comment = DEPT1 common share Directory&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; valid users = @DEPT1&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; read only = yes&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; write list = @DEPT1&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; path = /var/www/html/shares/DEPT1&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; create mode = 0660&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; directory mode = 0770&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; vfs object = full_audit&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; full_audit:prefix = %u|%I|%m|%S&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; full_audit:success = mkdir rename unlink rmdir pwrite&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;[DEPT2]&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; comment = DEPT2 common share Directory&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; valid users = @DEPT2&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; read only = yes&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; write list = @DEPT2&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; path = /var/www/html/shares/DEPT2&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; create mode = 0660&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; directory mode = 0770&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; vfs object = full_audit&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; full_audit:prefix = %u|%I|%m|%S&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; full_audit:success = mkdir rename unlink rmdir pwrite&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;[PUBLIC]&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; comment =&amp;nbsp; common share Directory&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; valid users = @DEPT1, @DEPT2&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; read only = yes&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; write list = @DEPT1, @DEPT2&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; path = /var/www/html/shares/PUBLIC&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; create mode = 0660&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; vfs object = full_audit&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; full_audit:prefix = %u|%I|%m|%S&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; full_audit:success = mkdir rename unlink rmdir pwrite&lt;br /&gt;&lt;br /&gt;[homes]&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; browsable = no&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; writable = yes&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/blockquote&gt;Most of the parameters are self explainatory, but lets a look at some of them.&lt;br /&gt;&lt;br /&gt;&lt;u&gt; invalid users&lt;/u&gt;:&lt;br /&gt;It is always good to set root as an invalid user as it is a good security practice&lt;br /&gt;&lt;br /&gt;&lt;u&gt;valid users:&lt;/u&gt;&lt;br /&gt;Indicates the users that are allowed to access this share, remember if you want a user to have write acess they have to be defined in the valid users section. here you can either specify a unix user or you an specify a unix group with the @symbol&lt;br /&gt;&lt;br /&gt;&lt;u&gt;vfs object:&lt;/u&gt;&lt;br /&gt;As we want to audit all that our users are doing on the shares we have to use the stackable vfs objects, the vfs object that we are using in this case is audit&lt;br /&gt;&lt;br /&gt;&lt;u&gt;full_audit:prefix:&lt;/u&gt;&lt;br /&gt;Prefix each log line with this information &lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;%u|%I|%m|%S&lt;/span&gt; where&lt;br /&gt;&lt;blockquote&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;%u - Username&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;%I - IP of the machine through which the action is being performed&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;%m - Hostname of the machine&lt;/div&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;%S - Share that is being affected&lt;/span&gt;&lt;/blockquote&gt;&lt;u&gt;full_audit:success:&lt;/u&gt;&lt;br /&gt;Log the following file operations &lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;mkdir rename unlink rmdir &lt;/span&gt;where&lt;u&gt;&lt;/u&gt;&lt;br /&gt;&lt;blockquote style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;mkdir - make directory&lt;br /&gt;unlink - delete file&lt;br /&gt;rmdir - delete directory&lt;/blockquote&gt;&lt;u&gt;syslog only:&lt;/u&gt; &lt;br /&gt;Send all log lines to syslog, even audit log lines will go there&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;You should get log lines similar to this in your messages file&lt;br /&gt;&lt;br /&gt;&lt;blockquote style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;May 15 06:40:21 server smbd_audit: user.name|172.16.10.118|host252|DEPT1|linux_setlease|fail (Permission denied)|resource.pdf&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3341953160726374446-1288214663524117592?l=samixblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://samixblog.blogspot.com/feeds/1288214663524117592/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://samixblog.blogspot.com/2011/05/samba-file-sharing-i.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3341953160726374446/posts/default/1288214663524117592'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3341953160726374446/posts/default/1288214663524117592'/><link rel='alternate' type='text/html' href='http://samixblog.blogspot.com/2011/05/samba-file-sharing-i.html' title='SAMBA File Sharing - I'/><author><name>samix</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3341953160726374446.post-3057852926600798417</id><published>2011-05-04T22:09:00.000-07:00</published><updated>2011-05-04T22:09:48.676-07:00</updated><title type='text'>Crontab Nicknames</title><content type='html'>Now this is great, it was right there under my nose in the crontab manual and I never got to it except today.&lt;br /&gt;&lt;br /&gt;My weekly cron was acting funny and running daily, so back I was pouring over the man page to refresh the meaning of each of the 5 control fields and I saw that for some standard schedules nick names can be used instead of the 5 control fields, to quote the man page&lt;br /&gt;&lt;blockquote style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;These special time specification "nicknames" are supported, which replace the 5 initial time and date fields, and are prefixed by the ’@’ character:&lt;/blockquote&gt;&lt;blockquote style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;@reboot&amp;nbsp;&amp;nbsp;&amp;nbsp; :&amp;nbsp;&amp;nbsp;&amp;nbsp; Run once, at startup.&lt;br /&gt;@yearly&amp;nbsp;&amp;nbsp;&amp;nbsp; :&amp;nbsp;&amp;nbsp;&amp;nbsp; Run once a year, ie.&amp;nbsp; "0 0 1 1 *".&lt;br /&gt;@annually&amp;nbsp; :&amp;nbsp;&amp;nbsp;&amp;nbsp; Run once a year, ie.&amp;nbsp; "0 0 1 1 *".&lt;br /&gt;@monthly&amp;nbsp;&amp;nbsp; :&amp;nbsp;&amp;nbsp;&amp;nbsp; Run once a month, ie. "0 0 1 * *".&lt;br /&gt;@weekly&amp;nbsp;&amp;nbsp;&amp;nbsp; :&amp;nbsp;&amp;nbsp;&amp;nbsp; Run once a week, ie.&amp;nbsp; "0 0 * * 0".&lt;br /&gt;@daily&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; :&amp;nbsp;&amp;nbsp;&amp;nbsp; Run once a day, ie.&amp;nbsp;&amp;nbsp; "0 0 * * *".&lt;br /&gt;@hourly&amp;nbsp;&amp;nbsp;&amp;nbsp; :&amp;nbsp;&amp;nbsp;&amp;nbsp; Run once an hour, ie. "0 * * * *".&lt;/blockquote&gt;&lt;br /&gt;So, I edited my posgresql data backup cronjob to look like:&lt;br /&gt;&lt;br /&gt;&lt;blockquote style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;# This is for the postgresql DB backup - daily&lt;br /&gt;@daily root /opt/scripts/wikidb_backup.sh daily&lt;br /&gt;&lt;br /&gt;# This is for the postgresql DB backup - daily&lt;br /&gt;@weekly root /opt/scripts/wikidb_backup.sh weekly&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3341953160726374446-3057852926600798417?l=samixblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://samixblog.blogspot.com/feeds/3057852926600798417/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://samixblog.blogspot.com/2011/05/crontab-nicknames.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3341953160726374446/posts/default/3057852926600798417'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3341953160726374446/posts/default/3057852926600798417'/><link rel='alternate' type='text/html' href='http://samixblog.blogspot.com/2011/05/crontab-nicknames.html' title='Crontab Nicknames'/><author><name>samix</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3341953160726374446.post-3970479348591225036</id><published>2011-05-04T03:07:00.000-07:00</published><updated>2011-05-05T03:41:25.691-07:00</updated><title type='text'>Adding Images MediaWiki</title><content type='html'>I wanted to put up a HOWTO on our internal wiki, which is mediawiki, and wanted to upload some images but coudnt find out how, even the official media wiki document says: &lt;br /&gt;&lt;blockquote style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;This page explains the &lt;b&gt;image&lt;/b&gt; syntax when editing the wiki. You or another user must usually upload an image before you can use it on a page.&lt;/blockquote&gt;&lt;br /&gt;But it does not explain how, another page states:&lt;br /&gt;&lt;blockquote style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;If file uploads are enabled, you can upload certain types of files to  the wiki. This is particularly useful for uploading images, which you  want to place on an article, but you can also upload other types of  files.&lt;/blockquote&gt;&amp;nbsp;But where to enable it ? finally with a little grep I found the switch in the Localsettings.php file and set it to true&lt;br /&gt;&lt;br /&gt;&lt;blockquote style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;$wgEnableUploads&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = true;&lt;/blockquote&gt;Reloaded my wiki page and got an 'upload file' option in the sidebar under toolbox&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3341953160726374446-3970479348591225036?l=samixblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://samixblog.blogspot.com/feeds/3970479348591225036/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://samixblog.blogspot.com/2011/05/adding-images-mediawiki.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3341953160726374446/posts/default/3970479348591225036'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3341953160726374446/posts/default/3970479348591225036'/><link rel='alternate' type='text/html' href='http://samixblog.blogspot.com/2011/05/adding-images-mediawiki.html' title='Adding Images MediaWiki'/><author><name>samix</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3341953160726374446.post-2200200528820044015</id><published>2011-05-03T23:22:00.000-07:00</published><updated>2011-05-03T23:23:10.086-07:00</updated><title type='text'>PostgreSQL Backup</title><content type='html'>We have mediawiki installed with a postgresql back end and I have procrastinated for too long about setting up backup so today I finally decided to do it using shell + pg_dump + cron&lt;br /&gt;&lt;br /&gt;I use the same script to do weekly as well as daily backup by passing the argument weekly or daily.&lt;br /&gt;&lt;br /&gt;Next, after zipping and taring the backup I delete all backups that are more than 5 days old to save on disk space.&lt;br /&gt;&lt;br /&gt;Here is the shell script:&lt;br /&gt;&lt;blockquote style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;#!/bin/bash&lt;br /&gt;&lt;br /&gt;PATH=$PATH:/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin&lt;br /&gt;&lt;br /&gt;if [ $# -lt 1 ]&lt;br /&gt;then&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; echo "usage: $0 daily|weekly"&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; exit 1&lt;br /&gt;fi&lt;br /&gt;&lt;br /&gt;if [ "$1" == "daily" ]&lt;br /&gt;then&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; BACKUPDIR=/database_backup/daily&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pg_dump -Uwikiuser wikidb &amp;gt; $BACKUPDIR/wikidb-daily-`date +%d%m%Y`&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if tar czf $BACKUPDIR/wikidb-daily-`date +%d%m%Y`.tar.gz $BACKUPDIR/wikidb-daily-`date +%d%m%Y`&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; then&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rm -f $BACKUPDIR/wikidb-daily-`date +%d%m%Y`&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fi&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; find $BACKUPDIR -name wikidb-daily\*tar.gz&amp;nbsp; -mtime +5 -exec rm {} \;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; exit 0&lt;br /&gt;fi&lt;br /&gt;&lt;br /&gt;if [ "$1" == "weekly" ]&lt;br /&gt;then&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; BACKUPDIR=/database_backup/weekly&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pg_dump -Uwikiuser wikidb &amp;gt; $BACKUPDIR/wikidb-weekly-`date +%d%m%Y`&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if tar czf $BACKUPDIR/wikidb-weekly-`date +%d%m%Y`.tar.gz $BACKUPDIR/wikidb-weekly-`date +%d%m%Y`&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; then&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rm -f $BACKUPDIR/wikidb-weekly-`date +%d%m%Y`&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fi&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; find $BACKUPDIR -name wikidb-weekly\*tar.gz&amp;nbsp; -mtime +5 -exec rm {} \;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; exit 0&lt;br /&gt;fi&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;echo "usage: $0 daily|weekly"&lt;br /&gt;exit 1&lt;/blockquote&gt;&lt;br /&gt;I normally set the path like above in all my shell scripts that I run from the cron so that I do not have to write full paths for command name, its just not natural.. &lt;br /&gt;&lt;br /&gt;Next shove it into cron so that it runs every day every and weekly&lt;br /&gt;&lt;br /&gt;&lt;blockquote style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;# This is for the postgresql DB backup - daily&lt;br /&gt;01 00 * * * root /opt/scripts/wikidb_backup.sh daily&lt;br /&gt;&lt;br /&gt;# This is for the postgresql DB backup - daily&lt;br /&gt;01 00 * * 4 root /opt/scripts/wikidb_backup.sh weekly&lt;/blockquote&gt;I also plan to scp the backup to some remote server so that if this server crashes completely I still can restore from there.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3341953160726374446-2200200528820044015?l=samixblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://samixblog.blogspot.com/feeds/2200200528820044015/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://samixblog.blogspot.com/2011/05/postgresql-backup.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3341953160726374446/posts/default/2200200528820044015'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3341953160726374446/posts/default/2200200528820044015'/><link rel='alternate' type='text/html' href='http://samixblog.blogspot.com/2011/05/postgresql-backup.html' title='PostgreSQL Backup'/><author><name>samix</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3341953160726374446.post-1468330284990117150</id><published>2011-04-30T23:43:00.000-07:00</published><updated>2011-05-01T00:36:17.216-07:00</updated><title type='text'>Abusing PostgreSQL Vacuum</title><content type='html'>I run a wiki site in my company here, and we use media wiki for this purpose, the back end of the site is a PostgreSQL database, It just occurred to me last night that I am not vacuuming the database, so I thought that I might as well set it up.&lt;br /&gt;&lt;br /&gt;The postgresql manual explains Vacuuming as,&lt;br /&gt;&lt;blockquote style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span class="COMMAND"&gt;VACUUM&lt;/span&gt; reclaims storage occupied by dead tuples.    In normal &lt;span class="PRODUCTNAME"&gt;PostgreSQL&lt;/span&gt;  operation, tuples that    are deleted or obsoleted by an update are not  physically removed from    their table; they remain present until a &lt;span class="COMMAND"&gt;VACUUM&lt;/span&gt; is    done.  Therefore it's necessary to do &lt;span class="COMMAND"&gt;VACUUM&lt;/span&gt;    periodically, especially on frequently-updated tables.   &lt;/blockquote&gt;&lt;br /&gt;I am running postgresql 8.4.4&lt;br /&gt;&lt;blockquote&gt;&lt;span style="font-size: x-small;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;template1=# show server_version;&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;server_version&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;----------------&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;8.4.4&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;(1 row)&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/blockquote&gt;&amp;nbsp;Reading postgresql wiki, I figured that running a full vacuum on my database is almost useless, rather detrimental as most of the operations on our wiki site are insert operations, and we rarely delete anything once it is put in.&lt;br /&gt;&lt;blockquote style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;Many people, either based on misguided advice on the 'net or on the assumption that it must be "better", periodically run &lt;code&gt;VACUUM FULL&lt;/code&gt; on their tables. This is generally a &lt;i&gt;really bad idea&lt;/i&gt; and can make your database &lt;i&gt;slower&lt;/i&gt; not faster.&lt;/blockquote&gt;So, I thought of putting a vacuumdb cronjob without the -f 'full' option, but a little more reading and I found that&amp;nbsp; postgreSQL database engines 8.4 and above come with an autovaccum daemon which takes care of the vacuum requirements, I did a quick ps and found the launcher process&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;[root@myhost ~]# ps aux | grep -i auto&lt;/span&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;postgres&amp;nbsp; 2901&amp;nbsp; 0.0&amp;nbsp; 0.0&amp;nbsp; 50348&amp;nbsp;&amp;nbsp; 776 ?&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Ss&amp;nbsp;&amp;nbsp; Apr27&amp;nbsp;&amp;nbsp; 0:00 postgres: autovacuum launcher process&lt;/span&gt;&lt;/blockquote&gt;In case you do not like the autovacuum daemon, you can disable autovacuum in the postgresql.conf file&lt;br /&gt;&lt;blockquote&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;autovacuum = off #on by default&lt;/span&gt;&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3341953160726374446-1468330284990117150?l=samixblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://samixblog.blogspot.com/feeds/1468330284990117150/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://samixblog.blogspot.com/2011/04/abusing-postgresql-vacuum.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3341953160726374446/posts/default/1468330284990117150'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3341953160726374446/posts/default/1468330284990117150'/><link rel='alternate' type='text/html' href='http://samixblog.blogspot.com/2011/04/abusing-postgresql-vacuum.html' title='Abusing PostgreSQL Vacuum'/><author><name>samix</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3341953160726374446.post-4872034376487067945</id><published>2011-04-28T01:55:00.000-07:00</published><updated>2011-04-28T02:19:33.514-07:00</updated><title type='text'>Perl logging to syslog</title><content type='html'>&lt;span style="font-family: Verdana,sans-serif;"&gt;Have you ever felt the need to log stuff from your perl script to syslog&amp;nbsp; because you want to send the debug information to the relevant place or just because it looks cool ?&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="font-family: Verdana,sans-serif;"&gt;look no further, here is how you can do this in a couple of steps using the&amp;nbsp; &lt;a href="http://search.cpan.org/%7Esaper/Sys-Syslog/Syslog.pm"&gt;Sys::Syslog&lt;/a&gt; module, here is a simple script to demonstrate this&lt;/div&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;#!/usr/bin/perl&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;use strict;&lt;br /&gt;use warnings;&lt;br /&gt;&lt;br /&gt;use Sys::Syslog qw(:DEFAULT setlogsock);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;setlogsock('unix');&lt;br /&gt;openlog('label-for -your-script','','info');&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;syslog('info', "look for me in messages");&lt;/span&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;div style="font-family: Verdana,sans-serif;"&gt;So, now when you execute this script you will get a line logged in /var/log/messages, similar to this&lt;/div&gt;&lt;blockquote&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;Apr 28 08:35:09 myhost label-for -your-script: look for me in messages&lt;/span&gt;&lt;/blockquote&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;One of the places where I used this was in a script that does a couple of tasks on a user request and does copius logging to syslog, the problem that I faced was that there was no way for me except time to club together the various log lines.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;Inspired by queue id I just edited the script to generate a unique 6 character key that I tagged along with each log line so that I can then grep for that unique character from the messages file&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;#!/usr/bin/perl&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;use strict;&lt;br /&gt;use warnings;&lt;br /&gt;&lt;br /&gt;use Sys::Syslog qw(:DEFAULT setlogsock);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;setlogsock('unix');&lt;br /&gt;openlog('label-for -your-script','','info');&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;my $random_id = random_string(6); &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;syslog('info', "$random_id: jack and jill");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;syslog('info', "$random_id: went up the hill");&lt;/span&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;syslog('info', "$random_id: to fetch a pail of water");&lt;/span&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt; &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;# generate a 6 digit random charecter&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;sub random_string {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp; my $length_of_randomstring=shift;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp; my @chars=('a'..'z','A'..'Z','0'..'9','_');&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp; my $random_string;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp; foreach (1..$length_of_randomstring){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $random_string.=$chars[rand @chars];&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp; }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp; return $random_string;&lt;br /&gt;}&lt;br /&gt;&lt;/span&gt;&lt;/blockquote&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;Now, if I run the script two three times, using the $random_id I can figure which log line was printed during which run. so with a little grep magic I can arrange the logs according to each run of the script&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;[root@myhost scripts]# grep LCEd9X: /var/log/messages &lt;br /&gt;Apr 28 08:48:05 myhost label-for -your-script: LCEd9X: jack and jill&lt;br /&gt;Apr 28 08:48:05 myhost label-for -your-script: LCEd9X: went up the hill&lt;br /&gt;Apr 28 08:48:05 myhost label-for -your-script: LCEd9X: to fetch a pail of water&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;[root@myhost scripts]# grep uYLs6s: /var/log/messages&lt;br /&gt;Apr 28 08:48:05 myhost label-for -your-script: uYLs6s: jack and jill&lt;br /&gt;Apr 28 08:48:05 myhost label-for -your-script: uYLs6s: went up the hill&lt;br /&gt;Apr 28 08:48:05 myhost label-for -your-script: uYLs6s: to fetch a pail of water&lt;br /&gt;&lt;br /&gt;[root@myhost scripts]# grep &lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;MWCz8p&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;: /var/log/messages&lt;/span&gt;&lt;/span&gt;&lt;/blockquote&gt;&lt;blockquote&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;Apr 28 08:48:03 myhost label-for -your-script: MWCz8p: jack and jill&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;Apr 28 08:48:03 myhost label-for -your-script: MWCz8p: went up the hill&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;Apr 28 08:48:03 myhost label-for -your-script: MWCz8p: to fetch a pail of water&lt;/span&gt;&lt;/span&gt;&lt;/blockquote&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;br /&gt;&lt;/span&gt; &lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3341953160726374446-4872034376487067945?l=samixblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://samixblog.blogspot.com/feeds/4872034376487067945/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://samixblog.blogspot.com/2011/04/perl-logging-to-syslog.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3341953160726374446/posts/default/4872034376487067945'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3341953160726374446/posts/default/4872034376487067945'/><link rel='alternate' type='text/html' href='http://samixblog.blogspot.com/2011/04/perl-logging-to-syslog.html' title='Perl logging to syslog'/><author><name>samix</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3341953160726374446.post-2130864071977837452</id><published>2011-04-27T21:17:00.000-07:00</published><updated>2011-04-27T21:17:01.470-07:00</updated><title type='text'>Lesser known keyboard combinations</title><content type='html'>&lt;div style="font-family: Verdana,sans-serif;"&gt;Here is one interesting keyboard that may come in handy while troubleshooting&lt;/div&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;shift+scrollLock&lt;/span&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;div style="font-family: Verdana,sans-serif;"&gt;This key combination dumps a lot of information with respect to the system memory, a dump similar to this, by the way this works only on the tty consoles.&lt;/div&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-family: inherit;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;cpu 0 hot: high 0, batch 1 used:0&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;cpu 0 cold: high 0, batch 1 used:0&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;cpu 1 hot: high 0, batch 1 used:0&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;cpu 1 cold: high 0, batch 1 used:0&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;DMA32 per-cpu: empty&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;Normal per-cpu:&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;cpu 0 hot: high 186, batch 31 used:27&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;cpu 0 cold: high 62, batch 15 used:7&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;cpu 1 hot: high 186, batch 31 used:165&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;cpu 1 cold: high 62, batch 15 used:2&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;HighMem per-cpu:&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;cpu 0 hot: high 42, batch 7 used:6&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;cpu 0 cold: high 14, batch 3 used:12&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;cpu 1 hot: high 42, batch 7 used:11&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;cpu 1 cold: high 14, batch 3 used:0&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;Free pages:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 66288kB (496kB HighMem)&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;Active:185046 inactive:35966 dirty:36 writeback:0 unstable:0 free:16572 slab:10810 mapped-file:25269 mapped-anon:149285 pagetables:1542&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;DMA free:4316kB min:68kB low:84kB high:100kB active:7708kB inactive:0kB present:16384kB pages_scanned:0 all_unreclaimable? no&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;lowmem_reserve[]: 0 0 880 998&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;DMA32 free:0kB min:0kB low:0kB high:0kB active:0kB inactive:0kB present:0kB pages_scanned:0 all_unreclaimable? no&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;lowmem_reserve[]: 0 0 880 998&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;Normal free:61476kB min:3756kB low:4692kB high:5632kB active:624292kB inactive:135404kB present:901120kB pages_scanned:0 all_unreclaimable? no&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;lowmem_reserve[]: 0 0 0 948&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;HighMem free:496kB min:128kB low:252kB high:380kB active:108184kB inactive:8460kB present:121368kB pages_scanned:0 all_unreclaimable? no&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;lowmem_reserve[]: 0 0 0 0&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;DMA: 11*4kB 2*8kB 4*16kB 5*32kB 1*64kB 1*128kB 1*256kB 1*512kB 1*1024kB 1*2048kB 0*4096kB = 4316kB&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;DMA32: empty&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;Normal: 843*4kB 4217*8kB 939*16kB 78*32kB 21*64kB 3*128kB 0*256kB 0*512kB 1*1024kB 0*2048kB 1*4096kB = 61476kB&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;HighMem: 52*4kB 6*8kB 1*16kB 1*32kB 1*64kB 1*128kB 0*256kB 0*512kB 0*1024kB 0*2048kB 0*4096kB = 496kB&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;71729 pagecache pages&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;Swap cache: add 188, delete 188, find 0/0, race 0+0&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;Free swap&amp;nbsp; = 2007332kB&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;Total swap = 2008084kB&lt;/span&gt; &lt;/blockquote&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3341953160726374446-2130864071977837452?l=samixblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://samixblog.blogspot.com/feeds/2130864071977837452/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://samixblog.blogspot.com/2011/04/lesser-known-keyboard-combinations.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3341953160726374446/posts/default/2130864071977837452'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3341953160726374446/posts/default/2130864071977837452'/><link rel='alternate' type='text/html' href='http://samixblog.blogspot.com/2011/04/lesser-known-keyboard-combinations.html' title='Lesser known keyboard combinations'/><author><name>samix</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3341953160726374446.post-6861346548156132252</id><published>2011-04-27T04:05:00.000-07:00</published><updated>2011-04-27T04:12:46.040-07:00</updated><title type='text'>Enabling arabic on centos</title><content type='html'>&lt;div style="font-family: Verdana,sans-serif;"&gt;considering that fact that I am working in the middle east, one of the jobs I have to do too often is to enable arabic on linux systems that we run so here is how to get this done&lt;/div&gt;&lt;br /&gt;&lt;div style="font-family: Verdana,sans-serif;"&gt;Install the arabic font rpm&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;yum install fonts-arabic &lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="font-family: Verdana,sans-serif;"&gt;now to enable switching between languages (english and arabic) run the following command&lt;/div&gt;&lt;br /&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;setxkbmap -symbols "pc(pc102)+jp(latin)+ara:2+group(alt_shift_toggle) " -option "grp_led:caps"&lt;/span&gt;&lt;/div&gt;&lt;pre style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: small;"&gt;puppet manifest for this rpm left as an exercise&lt;/span&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3341953160726374446-6861346548156132252?l=samixblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://samixblog.blogspot.com/feeds/6861346548156132252/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://samixblog.blogspot.com/2011/04/enabling-arabic-on-centos.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3341953160726374446/posts/default/6861346548156132252'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3341953160726374446/posts/default/6861346548156132252'/><link rel='alternate' type='text/html' href='http://samixblog.blogspot.com/2011/04/enabling-arabic-on-centos.html' title='Enabling arabic on centos'/><author><name>samix</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3341953160726374446.post-8734844479752412664</id><published>2011-04-26T23:28:00.000-07:00</published><updated>2011-04-26T23:30:32.163-07:00</updated><title type='text'>Yum for new users...</title><content type='html'>normally under centos or Redhat like operating systems package management is in the form of RPMS&lt;br /&gt;&lt;br /&gt;initially installing RPMs and their dependencies was a very complicated and long drawn manual process, until the arival of yum, so now with the appropriate repositories installed, yum does all the dirty work for you when the magical command is run&lt;br /&gt;&lt;br /&gt;yum install packagename # and so it will be done , after you press a 'y' ofcourse...&lt;br /&gt;&lt;br /&gt;now some terms that confuse new users&lt;br /&gt;&lt;br /&gt;&lt;u&gt;&lt;b&gt;Repositories:&lt;/b&gt;&lt;/u&gt;&lt;br /&gt;Repositories are mainly ftp ot http sites that expose rpms and metadata files, these repositories can be anywhere in the universe as long as the internet connection can span.&lt;br /&gt;&lt;br /&gt;Accessing the repositories is what matters a mortal user and yum does it for you using .repo files which are stored under /etc/yum.repos.d, a typical .repo file will look like this&lt;br /&gt;&lt;br /&gt;name=Software Repository&lt;br /&gt;baseurl=http://fqdn.for.repo/repo/&lt;br /&gt;enabled=1&lt;br /&gt;gpgcheck=1&lt;br /&gt;gpgkey=http://fqdn.for.repo/RPM-GPG-KEY&lt;br /&gt;&lt;br /&gt;You can keep adding repositories like rpmforge etc by installing rpms that they provide.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&lt;u&gt;&lt;b&gt;How Yum works&lt;/b&gt;&lt;/u&gt; &lt;br /&gt;So now when you type "yum install packagename" yum goes and reads the .repo files under /etc/yum.repos.d and connects to each of these localtions and tries to retrive the list of packages that the repository is holding ,the number of repositories that yum connects to is equal to the number of .repo files that have "enabled=1" &lt;br /&gt;&lt;br /&gt;next, it figures out if the package you requested in available and then installs it.&lt;br /&gt;&lt;br /&gt;&lt;u&gt;&lt;b&gt;Yum options&lt;/b&gt;&lt;/u&gt; &lt;br /&gt;Yum provides many other commands like list,update,groupinstall etc, read the manual for yum to figure out their operations.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3341953160726374446-8734844479752412664?l=samixblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://samixblog.blogspot.com/feeds/8734844479752412664/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://samixblog.blogspot.com/2011/04/yum-for-new-users.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3341953160726374446/posts/default/8734844479752412664'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3341953160726374446/posts/default/8734844479752412664'/><link rel='alternate' type='text/html' href='http://samixblog.blogspot.com/2011/04/yum-for-new-users.html' title='Yum for new users...'/><author><name>samix</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3341953160726374446.post-1742497511228523375</id><published>2011-04-26T22:56:00.000-07:00</published><updated>2011-04-28T03:47:35.260-07:00</updated><title type='text'>Desktop Recording</title><content type='html'>Have you ever felt the need to record your dektop session ? well now you can with - recordmydesktop, as the name suggests it is a desktop recording utility for GNU/Linux.&lt;br /&gt;&lt;br /&gt;Some days ago we needed to record a vnc session, vncserver does not seem to provide any such facility thus we installed the x11vnc which exposes -display 0 to the vnc-client, on top of this we ran recordmydesktop to record the session.&lt;br /&gt;&lt;br /&gt;&lt;u&gt;&lt;b&gt;Step 1:&lt;/b&gt;&lt;/u&gt; Install x11vnc&lt;br /&gt;yum install x11vnc&lt;br /&gt;&lt;br /&gt;&lt;u&gt;&lt;b&gt;Step 2:&lt;/b&gt;&lt;/u&gt; start x11vnc&lt;br /&gt;x11vnc -display:0 -forever&lt;br /&gt;&lt;br /&gt;The -forever option allows x11vnc to run like a daemon, sans "-forever" the clinet will be able to take only one vnc session and the x11vnc deamon will terminate&lt;br /&gt;&lt;br /&gt;This sets up the vnc serverside stuff for us, now onto recordmydesktop&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Step 1:&lt;/b&gt; Install recordmydesktop&lt;br /&gt;yum install recordmydesktop&lt;br /&gt;&lt;u&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/u&gt;&lt;br /&gt;&lt;u&gt;&lt;b&gt;Step 2:&lt;/b&gt;&lt;/u&gt; start recordmydesktop&lt;br /&gt;recordmydesktop --display :0 -o recordingfilename.ogv #this can be run from the command line&lt;br /&gt;&lt;br /&gt;Now lets go a step further and try to write puppet manifests for these two applications&lt;br /&gt;&lt;br /&gt;&lt;u&gt;&lt;b&gt;Puppet&lt;/b&gt;&lt;/u&gt;&lt;br /&gt;&lt;br /&gt;&lt;u&gt;manifest for recordmydesktop -&lt;/u&gt;&lt;br /&gt;&lt;br /&gt;class recordmydesktop {&lt;br /&gt;&amp;nbsp;&amp;nbsp; package { "recordmydesktop":&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ensure =&amp;gt; installed,&lt;br /&gt;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;u&gt;manifest for x11vnc -&lt;/u&gt;&lt;u&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/u&gt;&lt;br /&gt;&lt;br /&gt;class x11vnc {&lt;br /&gt;&amp;nbsp;&amp;nbsp; package { "x11vnc":&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ensure =&amp;gt; "installed", # here you can specufy a version or latest&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; notify =&amp;gt; Service["x11vnc"],&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; provider =&amp;gt; "yum",&lt;br /&gt;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp; ## if you have a init script to handle&lt;br /&gt;&amp;nbsp;&amp;nbsp; file { "/etc/init.d/x11vnc": &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ensure =&amp;gt; "present",&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; source =&amp;gt; "puppet:///modules/x11vnc/x11vnc.$hostname",&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; owner =&amp;gt; "root",&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; group =&amp;gt; "root",&lt;br /&gt;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp; service { "x11vnc":&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ensure =&amp;gt; "running",&lt;br /&gt;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3341953160726374446-1742497511228523375?l=samixblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://samixblog.blogspot.com/feeds/1742497511228523375/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://samixblog.blogspot.com/2011/04/desktop-recording.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3341953160726374446/posts/default/1742497511228523375'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3341953160726374446/posts/default/1742497511228523375'/><link rel='alternate' type='text/html' href='http://samixblog.blogspot.com/2011/04/desktop-recording.html' title='Desktop Recording'/><author><name>samix</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3341953160726374446.post-4180889748360056580</id><published>2011-04-26T03:15:00.000-07:00</published><updated>2011-05-07T09:32:23.724-07:00</updated><title type='text'>To be or not to be...</title><content type='html'>After working for three years in Directi in an intense IT setup I switched to Qatar to work in the Qatar Civil Aviation authority.&lt;br /&gt;&lt;br /&gt;Things are great here and we have a limited setup leaving a lot of time for me to delve in the vast ocean of open source technologies.&lt;br /&gt;&lt;br /&gt;This blog will be an attempt InshaAllah to salvage my current skills and foster them, I will be delighted If I am able to help people along the path..&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3341953160726374446-4180889748360056580?l=samixblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://samixblog.blogspot.com/feeds/4180889748360056580/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://samixblog.blogspot.com/2011/04/to-be-or-not-to-be.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3341953160726374446/posts/default/4180889748360056580'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3341953160726374446/posts/default/4180889748360056580'/><link rel='alternate' type='text/html' href='http://samixblog.blogspot.com/2011/04/to-be-or-not-to-be.html' title='To be or not to be...'/><author><name>samix</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
