Creating a Service to Start Task Scheduler

Task scheduler of Foresight Analytics Platform can be automatically started on Windows OS startup without logging in the system. The task scheduler can be installed to any local network application server as a service.

IMPORTANT. The application server scheduler and BI server are recommended to be started on different servers.

A service is an application that runs automatically at operating system startup without a user being logged into the system.

A task scheduler service is created after creating a configuration file and the creation procedure differs on the operating system in use:

The task scheduler is started in Linux OS using the init script for the initialization system. To do this:

  1. Create the Scheduler.service service using the command:

nano /etc/systemd/system/scheduler.service

NOTE. Executing the command requires the installed console text editor nano.

  1. Set the following variables for the scheduler.service service:

    • LC_NAME. It determines name localization settings.

For example:

LC_NAME=ru_RU.UTF-8

    • LANG. It determines localization settings.

For example:

LANG=en_US.UTF-8

    • PP_LOG. It determines debug info output about task scheduler work to file.

For example:

PP_LOG=1

Debug info will be written by default to the /var/log/syslog file, To change the path and name of the file, make changes in the registry.

    • TNS_ADMIN. It specifies the folder with configuration files of the SQL*Net network interface. The setting is mandatory only if Oracle DBMS is used.

For example:

TNS_ADMIN=/opt/foresight/fp10.x-biserver

    • WSFCfp_HOME. It specifies the folder with the WSO2 WSF/C framework to use web services in Foresight Analytics Platform. The setting is mandatory only if Oracle DBMS is used.

For example:

WSFCfp_HOME=/opt/foresight/fp10.x-biserver/bin

    • LD_LIBRARY_PATH. It specifies the path to the folder with dynamic libraries. The setting is mandatory only if Oracle DBMS is used.

For example:

LD_LIBRARY_PATH=$WSFCfp_HOME:$LD_LIBRARY_PATH

    • DISPLAY. It specifies number of the display, on which graphics is rendered. For example:

DISPLAY=:987

    • ORACLE_HOME. It specifies the Oracle DBMS client installation folder. The setting is mandatory only if Oracle DBMS is used.

For example:

ORACLE_HOME=/usr/lib/oracle/12.1/client64/

    • LSHOST. It specifies the location of license servers.

For example:

LSHOST=server1~server2

    • PATH. It specifies location of the PATH environment variable. The setting is mandatory only if Oracle DBMS is used.

For example:

PATH=$WSFCfp_HOME:$PATH

  1. For the startup command specify the full path to the configuration file, in which repository connection parameters are set and started objects. The following parameters can be used in the startup command:

    • -d. Indicates whether the file is started as a service. Specify the full path to the scheduler.exe file.

    • -p. The parameters for setting a custom folder, in which a pid file should be created. Specify the required path to the pid file. The parameter is used only with the -d parameter.

    • -x. Indicates whether scheduler debug info output redirection is disabled. The parameter can be used only with the -d parameter. Debug info will be written by default to the /var/log/syslog file. If the -x parameter is set, the standard output stream is used that is determined by scheduler startup option:

      • Startup from console - the console is used as the standard output stream.

      • Startup of the systemd initialization system service - the /var/log/syslog file or the file redetermined using the StandardOutput parameter is used as the standard output stream.

StandardOutput=file:/var/temp
ExecStart=/opt/foresight/fp10.x-biserver/bin/Scheduler -dx /opt/foresight/fp10.x-biserver/bin/scheduler.xml

  1. Start the systemd process using the command:

sudo systemctl daemon-reload

  1. Start the scheduler.service service using the command:

sudo systemctl start scheduler.service

NOTE. Before starting the task scheduler make sure that the registry.reg or Metabases.xml file contains the schema, for which the task schedule is to be started.

After executing the operations the task scheduler service is created and started in Linux OS.

Additional commands for working with the service

The example of settings of the scheduler.service service in different initialization systems when Oracle DBMS is used:

Settings for OS with the Upstart initialization system

Settings for OS with the systemd initialization system

The example of settings of the scheduler.service service with the systemd initialization system if PostgreSQL DBMS is used:

Settings for OS with the systemd initialization system

NOTE. If custom folders are used, specify the full path to them in the configuration variables of the task scheduler service.

To create a task scheduler service in Windows OS, start the command line under administrator and execute the command:

sc.exe create FPScheduler binpath= "C:\Program Files\Foresight\Analytics Platform 10.x\Scheduler.exe" start= auto

Where:

NOTE. If there is no space between the parameter (binpath or start) and its value, for example, start=auto instead of start= auto, the operation fails.

The following message is shown if the command has been successfully executed: [SC] CreateService: success.

To start the created service, run the following command:

net start FPScheduler

The following message is displayed if the command has been successfully executed: The FPScheduler service is successfully launched.

To delete a task scheduler service, run the following command:

sc.exe delete FPScheduler

The following message is shown if the command has been successfully executed: [SC] DeleateService: success.

See also:

Starting Tasks for Execution | Creating a Configuration File