The OTRS Scheduler is an independent system process that executes tasks in background. These kind of processes are know as daemons in Unix / Linux systems or as services on Windows environments. It is independent but that doesn't mean that the Scheduler does everything alone, it is fully integrated into OTRS and can use any OTRS module as needed to complete each task.
For sanity reasons the Scheduler process needs to be restarted from time to time. This is done automatically by the scheduler process itself once a day, but it can be adjusted as needed using the SysConfig by editing the "Scheduler::RestartAfterSeconds" setting.
The OTRS Scheduler is a fully automated process, the only needed human interaction is to check its status periodically and start or stop it as needed.
If the Scheduler is stopped for any reason, all pending tasks and new tasks registered when the Scheduler is stopped will be executed as soon as the Scheduler starts again (unless the tasks are set to be executed in the future).
The Scheduler is not visible in the OTRS Graphical User Interface unless it stops running.
There are two different types of notifications if the system detects that the scheduler is not running. This detection is based on the update frequency of the Scheduler process. If the difference between current time and the last process update time is 2 times the process update frequency a warning message will be displayed in the OTRS notification area. If it is over 4 times the process frequency then an alert will be displayed instead.
The Scheduler process update time can be configured via the SysConfig in the "Scheduler::PIDUpdateTime" setting.
If you see a warning message it is not always necessary to take an action, but it is highly recommended to check if the scheduler process is running. If you see an alert, then there is a high chance that the scheduler is in fact not running and should be started.
By default the Scheduler not running notification is enabled, if there is a valid web service registered in the database, and is only displayed to the users in the "admin" group.
To disable the notification (not recommended) or to change or add the notification groups, please edit the "Frontend::NotifyModule###800-Scheduler-Check" setting in the SysConfig.
Figure: Scheduler notification.
By clicking on the Scheduler not running notification link (either warning or alert) a dialog box will open to let you start the Scheduler process again. The Scheduler can be started normally or forced to start, by clicking on the appropriate check box in the dialog.
A forced Scheduler start is only necessary if previous Scheduler process was terminated abnormally and the Process ID is still registered in the database.
To have full control of the Scheduler process and to check it real status please use the command line tools described below.
Figure: Start Scheduler.
The Scheduler command line tools let you control the Scheduler process (Start / Stop) or query it status. There are also tools to register the process to be controlled by the operating system.
Included with OTRS there are two sets of CLI tools, one for Unix / Linux and another for Microsoft Windows.
Init.d files are special scripts that are called by the operating system at startup and shutdown.
OTRS provides init.d scripts to start / stop the OTRS Scheduler process automatically by the operating system. These scripts are located under OTRS_HOME/scripts.
The init.d scripts need to be copied to the correct location for your operating system. They need to have the proper permissions and some internal variables need to be set to work properly. If you used the OTRS RPMs to set up the system, this is taken care of automatically.
Init.d Script Internal Variables
OTRS_HOME - the path of your OTRS installation.
User - the apache process user name.
Group - the apache process user's group name.
Currently OTRS provides only init.d scripts for Linux platforms.
Table 4.7. List of init scripts and supported Operating Systems
Init Script | Supported OS |
---|---|
otrs-scheduler-linux | Red Hat, Fedora, CentOS, SUSE, openSUSE, Debian, Ubuntu |
otrs-scheduler-gentoo-init.d, otrs-scheduler-gentoo-conf.d | Gentoo |
Example 4.29. Example to start the OTRS Scheduler on linux
shell> /etc/init.d/otrs-scheduler-linux start
Available Actions
start to start the OTRS Scheduler process.
stop to stop the OTRS Scheduler process.
restart to restart the OTRS Scheduler process.
status to query the OTRS Scheduler process status.
The Scheduler needs the database to be available to register its Process ID, for this reason is necessary to:
Execute the Scheduler init.d script to start the Scheduler process after the database process is up and running.
Execute the Scheduler init.d script to stop the Scheduler before the database process shuts down.
If you want the Scheduler to run at system startup, please read the documentation of the operating system to find out the right location to place the init.d scripts, how to configure them to run automatically and how to set the run order.
This is the part of the Scheduler that stays running in the background checking for tasks to execute. It also provides the main functions to control the process.
All Unix / Linux uses the file OTRS_HOME/bin/otrs.Scheduler.pl.
Available Options
-a action.
Possible Values
start- to start the Scheduler process.
stop- to stop the Scheduler process.
status- to query Scheduler process status.
-f to force the start or stop of the Scheduler process.
Example 4.31. Example to force stop the OTRS Scheduler
shell> OTRS_HOME/bin/otrs.Scheduler.pl -a stop -f 1
Force stop the Scheduler is used remove the process ID from the database when the scheduler is not running and the process is still registered.
Force start the Scheduler is used to start the Scheduler process if the scheduler is not running and the process is registered.
Force start or stop are only necessary if the start of the process is needed to be done before the process update time expires. Otherwise an expired entry in the database is discarded by normal start.
On Windows, the OTRS Scheduler is registered as a Service via the Windows Service Control Manager (SCM). In order to have the OTRS Scheduler process to be controlled by the SCM is necessary to register this service. If you used the Windows Installer this is taken care of by the installer, and there are no manual actions required.
OTRS provides the script OTRS_HOME/bin/otrs.Scheduler4WinInstaller.pl to register or unregister the OTRS Scheduler into the SCM.
Registering and de-registering can only be performed by members of the Administrator group on Windows. You might need to right-click on cmd.exe and select 'Run as Administrator' before you can register the service correctly.
Example 4.32. Example to register the OTRS Scheduler as a Windows Service
shell> perl OTRS_HOME/bin/otrs.Scheduler4WinInstaller.pl -a install
Available Options
-a action.
Possible Values
install- to install the Scheduler process into the Windows SCM.
remove- to remove the Scheduler process from the Windows SCM.
After installing into the Windows SCM the OTRS Scheduler process can be used like any other service on Windows. It can be started, stopped and restarted and can be configured to be started manually or automatic.
To learn more about Windows Services and the Windows SCM please read the Windows documentation, and Microsoft online help.
This is the part of the Scheduler that stays running in the background checking for tasks to execute. It also provides the main functions to control the process.
Microsoft Windows uses the file OTRS_HOME/bin/otrs.Scheduler4Win.pl.
Example 4.33. Example to start the OTRS Scheduler on Windows
shell> OTRS_HOME/bin/otrs.Scheduler4Win.pl -a start
Available Options
-a action.
Possible Values
start- to start the Scheduler process.
stop- to stop the Scheduler process.
status- to query Scheduler process status.
-f to force the start or stop of the Scheduler process.
Example 4.34. Example to force stop the OTRS Scheduler on Windows
shell> OTRS_HOME/bin/otrs.Scheduler4Win.pl -a stop -f 1
Force stopping the Scheduler is used to remove the process ID from the database when the scheduler is not running and the process is still registered.
Force starting the Scheduler is used to start the Scheduler process if the scheduler is not running and the process is still registered.
Force start or stop are only necessary if starting the process is needed to be done before the process update time expires. Otherwise an expired entry in the database would be discarded by a normal start.