Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Switching between standalone EXE and windows service

I have written an application that on timer sends logs by mail. This application has a minimalistic user interface and once a config file is there it can start without the need of an interaction with the user.

Currently it is a VCL Forms application, but in some cases it would be good to have a service (in this way when running on a server there is no need to open a user session just to run the application).

What do you suggest for having both the worlds? In some simple scenario (smal organization, with just 3 pcs and no IT manager) a "non service" is good because it is easier to understand and to use, but in bigger organization the lack of service is a problem.

Is it possible to have a service and non service at the same time? How to achieve this? I don't want to make the deployment more complex, what I have in mind is some command line switch: when run with command line paramenters it can be a service, if not a normal app... How to do this?).

like image 775
LaBracca Avatar asked Nov 14 '11 11:11

LaBracca


2 Answers

OK...the best way is to develop 'service' and 'non service' application in the same project. Like explained here : A standalone Delphi application that can also be installed as windows service. So you may use the same application as service or as stand alone application.

If you want to have both on the same PC, it is more complicated : you have to add, in the stand alone application, the functions :

  • Verifiy if the service is running and active.
  • If the service is running and active, you have to dialog with it instead of runing the stand alone process.
like image 81
philnext Avatar answered Dec 12 '22 03:12

philnext


I would create a control panel applet that sets uf the config needed for your application and then convert your app into a service. Your control panel applet could also start, stop and restart the service, etc.

You now have the best of both worlds.

John

like image 20
John Avatar answered Dec 12 '22 01:12

John