Setting up Monit (On Ubuntu) ..

Apart from playing with the Source Code Open Source Software has given us.

Installing Monit :–


sudo apt-get install monit

This command will install Monit on Ubuntu.

In order to Start the Monit we need to edit file  “/etc/default/monit” and set the  “startup= 1”

This will start the Monit, but we need to do the real work inside the “/etc/monit/monirc”  file, and mention what all services we want to be monitored.

I have simply added a script for monitoring my Nginx Server

check process nginx with pidfile /var/run/
start program = “/etc/init.d/nginx start”
stop program  = “/etc/init.d/nginx stop”
group www-data

But before that we need to enable few other services as well like:–

set daemon  20           # check services at 2-minute intervals

set logfile syslog facility log_daemon    #for log analysis

set httpd port 2812 and
use address localhost  # only accept connection from localhost
allow localhost        # allow localhost to connect to the server and
allow admin:monit      # require user ‘admin’ with password ‘monit’
#     allow @monit           # allow users of group ‘monit’ to connect (rw)
#     allow @users readonly  # allow users of group ‘users’ to connect readonly


Once am done with this i will restart monit and see the status on localhost:2812 , we will see the status saying nginx is running.

let kill or stop Nginx and see the same url, you will see a message saying Nginx is stopped.


As we have asked the monit to check and restart the service at 2 minutes, you will see the process up and running again.



Delhi days ..

Its been almost over 15 days i left Delhi and moved to Pune 2 work for a startup.

One thing i realized during these days is never compare Delhi with any other City of India.

I remember my days of cribbing autowallas in Delhi, trust me they are better than the ones across India. 😛

So am not going to compare anything now as it always ends up me favoring 4 Delhi.

I miss the food, PVR and crazy bunch of my friends with whom i had most awesome days of my life.

Am sure of making a trip soon in January and spend time all around.

Curious case of Redmine Upgrade

Well i call it curious cos i been just told to upgrade Redmine without giving any other details.

some strange situation :–


$ dpkg -l rails [/php]

gave me nothing (omg my redmine instance running without Rails)

After some googling and #redmine irc channel i figured out like python easy_install and ubuntu/debian ruby uses gem.

So on typing


$ gem list –local

*** LOCAL GEMS ***

actionmailer (2.3.5)
actionpack (2.3.5)
activerecord (2.3.5)
activeresource (2.3.5)
activesupport (2.3.5)
fastthread (1.0.7)
passenger (2.2.11)
rack (1.0.1)
rails (2.3.5)
rake (0.8.7)
rmagick (2.13.1)


Told me these are the magical pkgs allready installed.

I also figured out with help of dpkg -l that i have mod_rails( and ruby 1.8 installed.

I had to spend some time to figure out what is current version of redmine installed on my server.there was a simple way to find that.

[php] $ elinks http://myredmine/admin/info[/php]

Redmine 0.9.6.stable (MySQL) <– this was my configuration.

Then i followed steps provided at

And yes,

I took mysql backup and filebkp too along with changing directory location in my virtualhost.

My 1$ Advice, please install additional plugins one by one from the repo which has latest release of it rather upgrading and moving the plugin from older version of Redmine else you will end up going in lot of shit. Most of the older plugin are still not supported in 1.0.X version of Redmine.

Recovering the deleted JPG files.

Its been some time i posted here, my apology.
It was great last evening as me Achet and Tanya wer out 4 dinner and at same time we been clicking our photos.

Tanya unknowingly deleted all the photographs we had taken that evening and she was feeling way to bad. I knew there must be some way to recover the data and hence i was relaxed.

After googling and speaking with Shastry i figured out the way to recover all the deleted images with a FOSS software name “Foremost”

Installing the software was 2 easy easy like always on ubuntu.

Checking the man of foremost i got basic idea about it.

steps i followed:–

1. installing foremost

[php]$ sudo apt-get install foremost

2. Figuring out the device name and mount point

[php]$ mount

it told me my drive is /dev/sdb1 execution

[php]$ sudo foremost -t jpg -i /dev/sdb1


I got a directory with name “output” in my current working directory with a subdirectory name “jpg” and i could see all my deleted images there.

I slept at 4 am and woke up at 9 and felt like sharing it with all of you so i wrote about it right away.


Curious case of denyhost and ssh.

I been using denyhost on my own server and many other boxes i been taking care of.

I was getting error whenever i tried connecting to my server
“ssh_exchange_identification: Connection closed by remote host”

After checking logfile i figured that its happening because of the denyhost. The documentation at the denyhost website explains how to remove the blacklisted Ip

Now i had to find real issue why is my legitimate IP getting blacklisted again and again?

My logfile gave me a Warning

Aug 25 16:39:34 vm27 sshd[13147]: reverse mapping checking getaddrinfo for [] failed – POSSIBLE BREAK-IN ATTEMPT!

To get this error removed what i did was, I had to add UseDns no to /etc/ssh/ssd_config file.

This removed warning messages and also i was not getting anymore issue of getting IP blocked from denyhost.