Pages - Menu

Python Fabfile to Install and Configure PostgreSQL 9.4

I was in a need to install and configure small size PostgreSQL 9.4 server on about 12 Red Hat Enterprise Linux 6 systems for our in-house application testing with following requirements,
  1. PostgreSQL 9.4 Server
  2. Disable TCP/IP socket authentication
  3. Configure maximum connections limit to 500
  4. Enable all SQL statements logging
We already had 10G free space available in a volume group on the servers so I decided to create a separate logical volume but keep the default PostgreSQL directory structure.

Here is the python fabfile that I created for the deployment,

This script can be used in multiple ways but first make sure Python package Fabric is installed on your deployment machine. In my case my deployment machine was my MacBook Air laptop. Python package Fabric can be easily installed using,

pip install Fabric

We can test this script on our vagrant machine,
  1. Download the script in the same directory as your Vagrantfile.
  2. Uncomment the line execute(vagrant) in the script.
  3. Make the script executable, chmod +x
  4. Just run the script
We can use this script using fab command,

fab -H <comma-separated list of hosts> -u <username> -f ./ postgresql

Also, we can update the script with hosts, username, password or path to SSH private key file and just execute the script.

Any feedback will be highly appreciated.

Getting Started with Vagrantfile

Now a days laptop hardware is becoming better and better day by day and the softwares like VirtualBox are making our laptops a perfect development environment. The good news is softwares like Vagrant are taking one step further to really deliver the development environment in much more efficient and automated way. Here is my first Vagrantfile that I created few months ago, if you are getting started with Vagrant then I think you will find this Vagrantfile useful,


Place this Vagrantfile in a directory and run command vagrant up in the same directory. Please install the Vagrant from if vagrant command is not available.

This Vagrantfile will create a CentOS 6.6 virtual machine using VirtualBox hypervisor and also configure few things like web server port forwarding, NAT, hostname and etc.

Any feedback will be highly appreciated.

Sample VIM Run Commands File (.vimrc)

I use VIM (advanced text editor) for writing scripts or short programs and I love it. All the cool features of VIM can be found at Here is the simple/sample VIM run commands file also known as .vimrc file that you may find useful,


Place the file in your home directory and it will enable following capabilities for you,
  1. Enable the ruler
  2. Set dark background
  3. Highlight the search text
  4. Enable the line numbers
  5. Color the column 75
  6. Set the tab size to 4 columns
  7. Convert tabs to spaces
  8. Highlight syntax
  9. Automatic indentation
  10. Remember the last cursor position

Please do let me know via comments what other things you have in your .vimrc file. Any feedback will be highly appreciated.

Bash Shell Script to Monitor Website Uptime

I was in a need to monitor the website up time on temporary basis so I decided to write a simple bash shell script to monitor the website up time and ran the script via cron every minute on my Ubuntu 14.04.2 LTS machine. If you are in a similar need then feel free to make use of it. The script can be found at,


Please make sure to update your notification email address in line 26 of the script. Also, -S smtp=<relay-host> is optional so feel free to remove it if you don't need to specify SMTP server.

Any feedback will be highly appreciated.