Installing FrontlineSMS as a Windows Service

20 Nov 2009
Posted by K. Sponberg

Recently I was approached by a few individuals who were all considering using FrontlineSMS in their projects.  The common question they asked is if FLSMS will run as a Windows service.  Any time you want an application to run in the background or when no user is actively logged into the computer, then the software needs to be set up as a service. 

In the specific context of FrontlineSMS, if you want to collect data, allow users to post information to a website, or perhaps provide an information-on-demand service via SMS, then the software needs to be setup as a Windows service so that your SMS application is available 24/7; and not simply when someone has actively logged into the computer.  Otherwise if the computer automatically logs the user out after a specified period of time, or a person intentionally logs out of a user account, then your SMS based service will stop running.  Clearly this is not the desired result, if you plan to use FLSMS in any scenario beyond personal messaging.  

For servers there is just no good way to remain always logged in and to have FLSMS continuously running.  On desktop versions of Windows you could set up the computer to remain always on and never logged out, but this presents some security risks and if nothing else is a little wasteful of electricity, if it forces your monitor to remain on all the time.    In the context of a national weather service's operations, you will likely want FrontlineSMS running on a server or on a desktop where it is a background process invisible to logged in users.  This better ensures that someone cannot accidentally stop or interfere with your mobile text messaging application.

Out of the box FrontlineSMS does not, however, have the ability to run as a Windows service.  You will need some helper application or wrapper to setup FrontlineSMS in this manner.  On Windows there are two free command line tools, InstSrv and SrvAny, provided by Microsoft.  Together these will allow you to take most ordinary software programs and install them as a Windows service.  The documentation of these tools is a little spotty and geared towards much older versions of Windows.  If you are not comfortable with using the command line, it can be a little daunting to set up.  As a result I did not review or test this free option in depth here.  In the near future RANET will provide tutorials on all the various options available for installing FrontlineSMS as a service once we have time to test and provide detailed instructions.

In the meantime there are a few commercial applications, which are easier to install and use.  For purposes of testing FrontlineSMS as a Windows service, I used FireDaemon Pro, but it is important to note that through a quick web search you can find similar applications.  FireDaemon Pro is a commercial product that will run on most any version of the Windows desktop or server OS since Windows 2000 / Server 2003.  While not free, a single license is relatively inexpensive. At the time of testing the basic 'Pro' version was $39, and there is a free 30-day trial available if you want to test FireDaemon for your specific application before committing funds.  Installation is easy and took about 5 minutes on both of my test machines.  Training material is available on how to use FireDaemon, so I will not cover the application in detail here, but overall using FireDaemon Pro is about as simple as selecting the software application you want to run as a service and then setting up some preferences.  

To have FronlineSMS run when a user is not actively logged into the computer or server, you do need to ask FireDaemon to run FLSMS as a desktop application.  Other than that the other preferences you select are totally dependent upon your environment and needs.  For instance, just like any service registered on a Windows OS, you can ask FireDaemon to attempt to restart the application one, two, or three times should it fail.  You could also write a separate script that can be triggered in the event of a service failure to either post information to an incident system or to simply send you an e-mail.

In terms of performance I installed FireDaemon Pro on both a Windows Vista and Windows Server 2003 machine.  I then configured each installation of FLSMS to use some 'Keywords' that sent off auto-reply messages, as well as used the HTTP request feature.  In FLSMS if you are doing any sort of automation to collect data or send auto-replies, you will almost certainly need to use the powerful 'Keyword' functionality it provides.  (See RANET's introductory tutorials on FrontlineSMS for details on using the 'Keyword' functionality.)  For both test systems, I left the computer / server running for a week and would randomly send messages to the FLSMS installation from my mobile phone.  The installations performed as expected in that they either posted information to a website I set up or responded to my SMS with another text message.   The test systems did this while there was not a user actively logged into the system.   I also performed numerous restarts and logged into and then off of each machine several times.  In every test FrontlineSMS continued operating and my GSM / GPRS modems remained actively connected.  I did not test FLSMS running as a service using an HTTP service like Clickatell.  In my tests I had modems directly connected to the computer or server.

The only negative part of my experience in these tests is that FLSMS performance seemed to lag somewhat.  It seemed to take an extra minute or two for messages to be processed.  In short it ran somewhat but noticably slower as a service than if it were normally installed as a desktop application.  It is hard to tell if this is an artifact of FireDaemon or just FLSMS when it is run as a service.  Nonetheless, the tests proved extremely successful.  If you plan to use FLSMS as a way to gather field data or to auto-reply to people's requests for information, you will need to set up the FrontlineSMS as a service using FireDaemon Pro or similar software. 

I hope that helps some users or potential users of FLSMS looking to take it beyond a personal messaging system.