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 server as a service.

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

    • TNS_ADMIN. It specifies the folder with configuration files of the SQL*Net network interface. For example:

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

NOTE. The setting is mandatory only if Oracle DBMS is used.

    • WSFCfp_HOME. It specifies the folder with the WSO2 WSF/C framework to use web services in Foresight Analytics Platform. For example:

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

NOTE. The setting is mandatory only if Oracle DBMS is used.

    • LD_LIBRARY_PATH. It specifies the path to the folder with dynamic libraries. For example:

LD_LIBRARY_PATH=$WSFCfp_HOME:$LD_LIBRARY_PATH

NOTE. The setting is mandatory only if Oracle DBMS is used.

    • 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. For example:

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

NOTE. The setting is mandatory only if Oracle DBMS is used.

    • LSHOST. It specifies the location of license servers. For example:

LSHOST=server1~server2

    • PATH. It specifies location of the PATH environment variable. For example:

PATH=$WSFCfp_HOME:$PATH

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

    • -p pid-path. Full path to the pid file.

    • -e. Indicates whether only error messages are logged, the rest of the messages are skipped.

    • -d. Indicates whether the file is started as a service.

    • -x. Indicates whether input/output/error streams are redirected. The key is ignored if the -e key is set.

  2. 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

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