The Events tab defines the program(s) to be run during service startup and service shutdown.


Launch Events and Termination Events programs are always run during service start-ups, controlled shutdowns, and intentional restarts. However, in certain situations, certain Termination Events programs may not be run - refer to Disposition below. 


Note: Launch Events and Termination Events programs run at the same priority as the main service. The priority is defined on the Settings tab.


Event programs will run for a finite time. Multiple Launch Event programs and Termination Event programs may be defined. The programs are executed in top-down order. The programs in the Launch Events list are run at the time the service is started. The programs in the Termination Events list are run at the time the service is stopped.


If the Event programs run for an unusually long period of time, the Service Control Manager may consider the service to have frozen.


If the service is configured as a Console Application on the Lifecycle tab, the Launch Events and Termination Events programs will be terminated as if they were console applications. Otherwise, they will be terminated as if they were GUI applications.


FireDaemon Pro automatically provides a set of standard FD environment variables to each Launch and Termination Event program - for details refer to About Environment Variables.



The following table describes the functions provided on the Events tab. The same functions are separately provided for Launch Events and Termination Events.


ButtonDescription
Promote (Up Arrow)Moves up (promotes) the currently selected entry to a higher position in the programs list.
Demote (Down Arrow)Moves down (demotes) the currently selected entry to a lower position in the programs list.
InsertInserts a new program definition immediately above the current position in the programs list.

For more information about the Event Information dialog box, see Launch / Termination Event.
AppendAdds a new program definition to the end of the programs list.

For more information about the Event Information dialog box, see Launch / Termination Event.
EditEdits the currently selected program in the programs list. In the list, select the program that you want to edit and click the Edit button.

A program definition can also be edited simply by double-clicking on its list entry.

For more information about the Event Information dialog box, see Launch / Termination Event.
RemoveDeletes the currently selected program from the programs list.

Note: The program definition is immediately removed. No confirmation prompt is displayed.


Launch / Termination Event


On the Events tab, when you click the Insert or Append or Edit button, the Event Information dialog box appears for the Launch Event program and Termination Event program.


Launch Event



Termination Event



When a program is set to run before the event, the following applies:

  • For Launch Event programs, the Event program is started and runs to completion. The service is then started.
  • For Termination Event programs, during an intentional shutdown, the Event program is started and runs to completion. The service is then stopped.

When a program is set to run after the event, the following applies:

  • For Launch Event programs, the Event program is started immediately after the service has been started.
  • For Termination Event programs, after the service has stopped or finished, the Event program is started and runs to completion.
Note: Termination Event programs are not executed in certain situations - see Disposition below.


The following table describes the fields provided on the Event Information dialog box.


FieldDescription
DispositionThis field determines when to run the Event program.

The following options are available for Launch Event programs:
  • Before Program Launch: Run the Event program before the service program is launched.
  • After Program Launch: Run the Event program after the service program has been launched.
  • Send Command: Run the Event program by sending the command.


The following options are available for Termination Event programs:

  • Before Program Termination: Before termination, run the Event program.
  • Send Command: Before termination, run the Event program, with its output going to the service program's input (stdin). This action will send the command output and continue with the preferred Shutdown By method for terminating the process in the Lifecycle tab.
  • Send Close: Before termination, run the Event program, with its output going to the service program's input (stdin) to perform a Close action. This action replaces the standard Shutdown By Graceful Close method of terminating the process in the Lifecycle tab. The Shutdown By option in the Lifecycle tab must be set to Graceful Close otherwise the actual Shutdown By setting will take precedence.
  • After Program Termination: Run the Event Program after the service program has terminated, regardless of its exit state.
  • After Program Completion: Run the Event Program after the service program has completed, i.e. has not crashed.
  • After Program Crash: Run the Event program after the service program has crashed (i.e. when its exit code is any value of 0x40000000 or higher, except for 0xc000013a [STATUS_CONTROL_C_EXIT]).


Note: FireDaemon Pro does not run certain Termination Event programs in certain situations:

  • If the service program terminates by itself (i.e. exits), then Before Program Termination, Send Command and Send Close Event programs are not run.
  • No Termination Event programs are run during a normal restart (i.e. when a service's Upon Program Exit setting is set to Restart Program and a restart is performed)
  • No Termination Event programs are run if a service is killed (either by the FireDaemon 'Kill All' function, or by Windows itself, or separately by a user).


For details about which Event programs are executed in various launch scenarios, refer to FireDaemon Pro Events and Triggering Points

ProgramThe full path and name (including the file extension) of the Event program.

For example, C:\Program Files\myProgram\program.exe
Working DirectoryThe working directory of the Event program.

This must be a valid path on the local disk or a Universal/Uniform Naming Convention (UNC) path to a network drive.

Note: There are a significant number of caveats associated with using UNC paths. Be warned!
ParametersThe optional list of command line parameters that are passed to the Event program.

If any parameter contains whitespace characters, it must be quoted, e.g. "string with spaces"
Execution TimeThe maximum execution time period (In milliseconds) within which the Event program is expected to complete.

If the program exceeds this time limit, FireDaemon Pro will forcibly terminate the program regardless of its current state.

This time also has a bearing on the overall time the service takes to start or stop.

Note: A generous time allowance is recommended. If the Event program completes before the end of the execution time period, FireDaemon Pro will immediately continue with the next Event program in the list (if any).
Run DetachedIf this option is selected, the Event program will simply be executed. The Execution Time is observed, but FireDaemon Pro will not attempt to terminate the Event program once the Execution Time has elapsed.