General principles of all services¶
- Table of contents
- General principles of all services
Program Start Modes¶
The program can be run in four modes:
- Installer;
- Configuration;
- Service;
- Application (service emulation).
Several copies of service¶
The system can create more than one instance of a service belonging to the same executable file.
To distinguish between service copies, a user identifier (postfix) is used, which, when registered in the system, is added to the main name of the service.
For example:
RDS_SERVICE - the name of the default service instance;
RDS_SERVICE_myname - the name of the service instance with the user ID.
Configuration files¶
Regardless of the mode of operation, service programs store settings only in the SYSTEM folder in the root directory of the Digispot system.
In the Installer mode, the format of the name of the settings file is completely similar to the settings files of other programs Digispot, i.e. has the form:
ProfileName.ApplicationName.ini
For example:
Base.RDS_SERVICE.ini
In the Configuration, Service and Application modes, the tag "service" and the custom instance identifier are added to this name:
ProfileName.service.ApplicationName_IdentifierInstance.ini
For example:
Base.service.RDS_SERVICE_myname.ini
Event System Configuration Files¶
The event system configuration files, if needed, should be created for each of the service instances separately, and the names of these files should include a user identifier (if any).
For example:
RDS_SERVICE_myname.xml
Log files¶
The path by which the program log files are created is now configured for each service instance individually. File names also reflect the mode of the program and user ID.
In the Installer mode:
NameApplication_Date_Time.txt
For example:
rds_service_2013-09-20__16_48_41.txt
In the Configuration, Service and Application modes:
service.ApplicationName_CustomIdentifier_Date__Time.txt
service.rds_service_myname_2013-09-20__17_04_08.txt
Service program operation modes¶
Installer¶
The program runs in the default installer mode (no additional command line parameters are required).
In this mode, a dialog box opens, allowing, first, to create, delete and configure services in the operating system, and second, to register service instances that work only in emulation mode.
The Service tab allows you to create real Windows services and launch them.
In the Service list, an instance of the service is selected from the list of installed on the system.
The Create button creates and installs a new instance of the service. The program asks the user for an instance ID. If you leave the identifier string empty, a service instance will be created with the default name. If the instance was originally created as an emulator, it is allowed to recreate it as a real service by creating an instance with the same name on the Service tab. Immediately after the creation, the configurator will be launched to configure the new service.
The Delete button uninstalls the existing service instance.
In the Startup type list, you can set the type of service start (Automatic, Disabled or Manual). The Apply button saves the changed startup type.
The Emulator tab allows you to create service emulators and start services in the application mode.
On the Emulator tab, the list contains both the names of these services and the emulators created, the latter marked as [emulation].
The Create button creates a service emulator that can only be run as an application.
The Delete button deletes the selected emulator.
The Start Options field displays the service start line, indicating the path to the executable file and additional parameters.
The Status field indicates the current state of the service instance. If it works, it is additionally indicated whether it is launched as a real service (service) or as an application (emulation).
The Start and Stop buttons start and stop the service instance. If the Service tab is active, this service will be launched, if the Emulator tab is used, then the service is as an application.
The Settings button starts the service in configuration mode. The same configuration is used by the service in both operating modes.
Configuration¶
To run in this mode, use the “/serviceconfig” command line parameter.
Work in this mode depends entirely on the specific implementation, but it is assumed that the program should open a dialog box with service settings.
Service¶
In this mode, the program is started and stopped only through the same program in the Installer mode (from the Service tab) or from the Windows service manager.
Application (service emulator)¶
To run in this mode, use the command line parameter "/serviceapp".
The work of the program will be identical to the work of the service, with the exception that the application will be launched, not the service. This is useful primarily for debugging.
Each running instance of the program creates its own icon in the Windows control panel tray. The name of the icon corresponds to the name of the application instance (with user ID). When you right-click on the icon, a context menu appears. Its contents may vary, but by default there are two items:
Control Panel: start the same program in the Installer mode.
Shut down: shut down the instance of the application.
Dump recording and service restart in case of a crash¶
If the service fails and it has to complete, it writes a dump to the DMP folder before stopping. In the accompanying dump file "* .ver" the user identifier of the service Service instance is additionally indicated.
If the service was launched in the real service mode,after the crash, it will automatically restart within 5 seconds. If there are more than 3 failures successively, at subsequent crashes, the dumps will no longer be written, until the service is manually restarted.
Command line parameters¶
Services support the following command line parameters:
/serviceconfig — launch in service configuration mode;
/serviceapp — launch in application mode (service emulation);
/install - installs the service with the specified instance identifier, then finishes the application;
/uninstall - uninstalls the service with the specified identifier of the instance, then finishes the application;
/instance=N - optional parameter, can be applied with all previous keys; indicates the user ID of the service instance.
The following options are supported for backward compatibility only:
-app- same as /serviceapp;
-appstart- same as /serviceapp;
-install- same as /install;
-uninstall- same as /uninstall;