Starting and Stopping the Ruby Notifier Process

by dbaldwin

Your Foundation server comes with a Ruby notifier process pre-installed. This process is responsible for dispatching email notifications when certain events happen within your Rails application. This may consist of a geofence violation (enter/exit), a speed threshold being exceeded, or a device going offline after a certain amount of time. The notifier is part of your Rails application, but is started and stopped separately from the application. This should happen automatically when deploying with Capistrano, but we’ll save that for a future article.

When you receive your Foundation welcome email the Ruby notifier automatically be up and running. There are certain situations where you may need to stop or restart the notifier process. To do this you’ll need to SSH into your server and first check to see if it’s running:

ps wwaux | grep notifier

In most cases the notifier will be running and you’ll see something that looks like the following:

ublip   27282 0.0 10.4 132100 54988 ?      Sl   2008 17:33 notifier.rb

If the notifier is not running you won’t see any results. So let’s go ahead and take a look at how to stop the notifier. Your Foundation welcome email points out a few useful directories while doing development. One of these is the Rails directory, which is located at /opt/ublip/rails/current. Let’s change to that path:

cd /opt/ublip/rails/current

Stopping the notifier is as simple as issuing the following command:

script/daemons stop

This should take no time at all to return and your notifier process has been stopped. To start it back up you simply need to issue the following:

script/daemons start

It’s useful to keep in mind that any exceptions that come into the system while the notifier is turned off will be processed when it’s started back up.