Running simpolserver.exe
as a Service
In a production environment, you would ideally want the database server to start when the
server starts, and to shut down gracefully when the server shuts down. Using Linux, this is
quite easy depending on your distribution. It is fairly trivial to add /usr/bin/smprun
/home/me/simpolserver.smp /home/me/simpolserverinfo.cfg
to the start up of the
server and /usr/bin/smprun /home/me/serverclose.smp 12345
to the shut down of the
server (typically something like local.start
and
local.stop
in /etc/conf.d/
or
baselayout1.start
and baselayout1.stop
in
/etc/local.d/
). Linux makes a lot of things easier,
which is why we only have one loader program for both console and windowing programs. On
Windows, this is all much more complicated.
We created a special program that can run a specified program as a service, with a second
program that can be run to stop the service. The program is called
svcrunnr.exe
. To install the service running program, from the command
line run this: svcrunnr.exe -install
. To remove the service, use this command
line: svcrunnr.exe -remove
. Before you start the service, it is useful to check
that everything is correctly configured.
Once the service is installed, it is important to check its configuration file. The name of
that file is: svcrunnr.exe.ini
. This is a very simple file and it needs to
be located in the same directory as the svcrunnr.exe
program. It contains
two sections, each with only one entry:
svcrunnr.exe
Configuration File[Startup] Command=C:\SIMPOL\bin\simpolserver.exe [Shutdown] Command=C:\SIMPOL\bin\serverclose.exe
Normally, there should be no reason to change this configuration file unless the locations are
incorrect. It is specific to the installation of the simpolserver.exe
suite
of programs.
Note | |
---|---|
Only one instance of this service can be running and/or installed concurrently, so there is no easy use that can be made of the service runner for other purposes. At some point we will release a more powerful service loader for SIMPOL. |
After checking the configuration file and after making sure that the
simpolserverinfo.cfg
is correctly set up (because this method will
always use this file name), if the server should run automatically, then it needs
to be set to do so. Upons installation it is set up to run manually only. To change this, in a
console window, or in the menu enter services.msc
in the
search window and press Enter. The services program will start. Navigate in the
list to the SIMPOL Scripted start/stop
entry as shown below:
Double-click on the entry in the list and in the pop up window change the startup type to Automatic so that it runs when the computer starts, then click on the button to start it running. See the image below:
That's it! The database engine will now run automatically when the server starts, and will
automatically shutdown when the server is shutdown. To see what is happening and to control it, the
simpolserverclient.exe
program can be run.