Running Cumulus as a Windows Service
Posted: Sat 26 Jan 2013 11:39 am
There are a couple solutions to make a program that is designed to run at the console (on your screen) as a service.
For the non-geeks: Cumulus is a program that will run interactively, on your Windows box, if you logon and start it. A Windows Service can be configured to run whenever the PC is powered on, even when you don't log on to it. Programs that run as a service do not need any user interaction to do their work. The concept of a service is ideal for software that needs to constantly be active, for instance to monitor conditions and act upon them. a Cumulus service would monitor your weather station's input, and update a data repository based on that input.
A service will (if so configured) be started by the operating system as soon as the operating system starts, even when you don't log on to the computer. It will create its own user context (something like "log on itself"), either under a System context (which gives it unlimited access to the system), or under a specific user context.
To be able to do this, the program must be specifically written as a Windows Service. There are, however, a couple ways around this, such as srvAny (an MS utility), or ServiceEx (http://serviceex.com/). This would enable you to run Cumulus as a service.
Again: the main advantage of this would be that, if your computer restarts for whatever reason (power failure and subsequent recovery, system crash and reboot), Cumulus restarts too, without you having to log on and start it.
There is, however, a huge disadvantage to this: if you do this, you loose the Cumulus user interface. You cannot start Cumulus twice; it would create mayhem, because there would be two instances of Cumulus competing for the same weather station input. I have not tried this, but I can foresee chaos.
What I am tempted to do is:
- write a service that monitors the Cumulus data store, and stores all values in a SQL database (I could currently support MS SQL, Oracle, and MySql, but SqLite seems to be possible as well).
- write a front end that accesses the database to replicate the functionality of the Cumulus user interface.
Why do I want to do this?
1. well, first of all, because. Just because.
2. because it allows me to run Cumulus as a service, thus enabling continuous data collection, even when my machine restarts while I am on vacation. It would be rather inconvenient to have to return from, say, Loch Tay, to Cothen because my server has rebooted.
3. because I can (and secretly because I believe I am actually effin' good at this, but I cannot say things like these aloud)
and...
4. because, even now with 4 grandchildren, I am a kid at heart. I want to play, and to me, this constitutes playing. This is actually the real explanation of reasons 1 and 3.
If there is anyone who can give me a fifth reason, like "oh yes I absolutely need this feature but I *hate* programming so I am not gonna do it myself", please chime in. I might just gather enough motivation to actually *do* it rather than think about the possibilities.
For the non-geeks: Cumulus is a program that will run interactively, on your Windows box, if you logon and start it. A Windows Service can be configured to run whenever the PC is powered on, even when you don't log on to it. Programs that run as a service do not need any user interaction to do their work. The concept of a service is ideal for software that needs to constantly be active, for instance to monitor conditions and act upon them. a Cumulus service would monitor your weather station's input, and update a data repository based on that input.
A service will (if so configured) be started by the operating system as soon as the operating system starts, even when you don't log on to the computer. It will create its own user context (something like "log on itself"), either under a System context (which gives it unlimited access to the system), or under a specific user context.
To be able to do this, the program must be specifically written as a Windows Service. There are, however, a couple ways around this, such as srvAny (an MS utility), or ServiceEx (http://serviceex.com/). This would enable you to run Cumulus as a service.
Again: the main advantage of this would be that, if your computer restarts for whatever reason (power failure and subsequent recovery, system crash and reboot), Cumulus restarts too, without you having to log on and start it.
There is, however, a huge disadvantage to this: if you do this, you loose the Cumulus user interface. You cannot start Cumulus twice; it would create mayhem, because there would be two instances of Cumulus competing for the same weather station input. I have not tried this, but I can foresee chaos.
What I am tempted to do is:
- write a service that monitors the Cumulus data store, and stores all values in a SQL database (I could currently support MS SQL, Oracle, and MySql, but SqLite seems to be possible as well).
- write a front end that accesses the database to replicate the functionality of the Cumulus user interface.
Why do I want to do this?
1. well, first of all, because. Just because.
2. because it allows me to run Cumulus as a service, thus enabling continuous data collection, even when my machine restarts while I am on vacation. It would be rather inconvenient to have to return from, say, Loch Tay, to Cothen because my server has rebooted.
3. because I can (and secretly because I believe I am actually effin' good at this, but I cannot say things like these aloud)
and...
4. because, even now with 4 grandchildren, I am a kid at heart. I want to play, and to me, this constitutes playing. This is actually the real explanation of reasons 1 and 3.
If there is anyone who can give me a fifth reason, like "oh yes I absolutely need this feature but I *hate* programming so I am not gonna do it myself", please chime in. I might just gather enough motivation to actually *do* it rather than think about the possibilities.