Pre-Service / Post-Service Tab
Previous Topic  Next Topic 


The Pre-Service and Post-Service tab allows applications to be run during service startup and service shutdown. Pre-service and post-service programs are always run during service start-ups, controlled shutdowns, and intentional restarts. However, if the service program crashes, only the pre-service program is run. Note that Pre-Service / Post-Service programs run at the same process priority as the main application. The process priority is defined in the Advanced tab.


These applications will be run for a finite time period. Multiple pre- and post-service applications may be defined, in which case they are run serially, in the order listed with Before Event applications being run prior to the service being started or stopped and After Event applications being run after the service has been started or stopped. If the applications specified here run for unusually long periods of time then the Service Control Manager may consider the service hung. If you check Console Application in the Program tab, Pre-Service and Post-Service applications will be terminated as if they were console applications - otherwise they will be terminated as if they were GUI applications (providing they are still running after the execution time has elapsed).



The following table describes the functions of each button in the pre-service program grouping.  The equivalent buttons in the post-service program group operate in an identical manner, and so are not described any further.


Button

Purpose

Promote (Up Arrow)

This moves the currently selected entry in the pre-service program list one position upwards.

Demote (Down Arrow)

This moves the currently selected entry in the pre-service program list one position downwards.

Insert

This inserts a new pre-service program definition into the pre-service list immediately before the currently selected list entry.

Append

This adds a new pre-service program definition to the end of the pre-service list.

Edit

This edits the currently selected pre-service program entry. Select the entry to be edited by clicking or double clicking on it.

Remove

This deletes the currently selected entry in the pre-service program list.


Clicking on the Insert or Append buttons opens the Program Information dialog box.  This is where the details of the pre- or post-service program are entered.



Field

Purpose

Executable

This is the full path and name (including the file extension) of the pre- or post-service program, e.g. C:\Program Files\PreApp\preapp.exe

Working Directory

This is the working directory of the pre- or post-service program. This must be a valid path on local disk or Universal/Uniform Naming Convention (UNC) path to a network drive (there are a significant number of caveats associated with the use of UNC paths in services so be warned).

Parameters

This is an optional list of parameters that can be passed to the executable. It may contain user, system or service specific environment variables (eg. %MYVAR%).

Execution Time

This is the number of milliseconds that the pre- or post-service program is expected to run. If the program exceeds this time limit, FireDaemon Pro will forcibly terminate it, irrespective of what it is doing. This time also has a bearing on the overall time the service takes to start or stop. Be generous with the amount of time you stipulate here. If the pre- or post-service program runs in less time than the anticipated Execution Time then FireDaemon will not wait  and will continue to execute the next pre- or post-service program.

Run Program

This field has two settings Before Event and After Event. The operation of these settings is explained below.

Run Detached

If this is checked, the Pre-Service or Post-Service Program will simply be executed. The Execution Time is observed but FireDaemon Pro will not attempt to terminate the program once the Execution Time has elapsed.


Run Program Setting

Pre-Service Program

Post-Service Program

Before Event

The pre-service program is started and then runs to completion. The service application is then started.

During an intentional shutdown, the post-service program is run to completion before stopping the service application.

After Event

The pre-service program is started immediately after the service application has been started.

After the service application has stopped or finished, the post-service program is started and then runs to completion. The post-service program is not run if the service application crashes.