The OTRS Daemon is an independent set of system processes that plan and execute tasks in background, either on a recurrent basis or triggered by events. OTRS Daemon is fundamental for the correct system operation.
In previous versions of OTRS (from 3.1 to 4) there was another process called OTRS Scheduler that does part of the work that the OTRS Demon do in OTRS 5. This old process is replaced by the OTRS Daemon which was re-written from the ground to make it more stable, scalable and robust than its predecessor.
The OTRS Daemon is capable to handle up to 10 tasks at the same time and it can work cooperatively with other OTRS Daemons on different frontend servers in a cluster environment.
When idle OTRS Daemon consist in six processes:
The main daemon (bin/otrs.Daemon.pl
)
This process is in charge to start and keep running the other children daemons.
Task worker daemon
(Kernel/System/Daemon/DaemonModules/SchedulerTaskWorker.pm
)
This daemon executes all tasks that have in a list, in a first in first out basis. It can handle simultaneous tasks by creating its own children processes and it checks the task list several times per second. The task list can be filled by task manager daemons, event handlers, and other parts of the system.
Its main mission is to handle all the tasks in the list as soon as possible.
Future task manager daemon
(Kernel/System/Daemon/DaemonModules/SchedulerFutureTaskManager.pm
)
This daemon checks for non recurring tasks that are set to be executed in the future (e.g. when a Generic Interface invoker tries to reach a server and it can't, a task could be set to schedule for execution in the next 5 minutes). At the correct time it sends it the task worker daemon.
Cron task manager daemon
(Kernel/System/Daemon/DaemonModules/SchedulerCronTaskManager.pm
)
This daemon calculates when is the next execution time of all recurring tasks (e.g. a cache cleanup one time per week ). This kind of tasks are specified in the SysConfig. At the right time for each task it sends the required information to the task worker daemon to execute them.
If a task execution time definition is changed in SysConfig, it might take up to an hour for the daemon to pick up the change automatically. Alternatively the OTRS Daemon can be restarted to apply the change immediately.
Generic Agent task manager daemon
(Kernel/System/Daemon/DaemonModules/SchedulerGenericAgentTaskManager.pm
)
This daemon scans for Generic Agent jobs stored in the database that have a time schedule (discarding all other Generic Agent jobs that are set to executed by events). When is time to run a Generic Agent job it sends the task information to the task worker daemon to handle the task.
System Configuration sync manager daemon
(Kernel/System/Daemon/DaemonModules/SystemConfigurationSyncManager.pm
)
This daemon verifies that the configuration file Kernel/Config/Files/ZZZAAuto.pm
is up to date with the deployment information from the database, otherwise the
file is updated. and signal the main daemon to restart all daemon modules with
the updated configuration.
Additionally if any other .pm file in Kernel/Config/Files/
is modified while the daemon is running, it will also signal the main daemon to
restart all daemon modules.
The number of active processes depends on the number of tasks that the OTRS Daemon is executing simultaneously in a time frame.
By default the each daemon logs all error messages on a separated file located in
/opt/otrs/var/log/Daemon/*.log
. These logs are kept in the system for
a defined period. To change this behavior and/or to also log the non error messages, please
update SysConfig settings in Daemon
-> Core::Log
.
When a task could not be executed successfully for any reason, an email is sent to a predefined recipient reporting the issue. The content of the email includes the error messages and trace (if available).
The OTRS Daemon is an automated process that normally does not require human interaction. However it is possible to query its status and start or stop it if needed.
To be sure that the OTRS Daemon is running there is a Cron job that constantly checks that the process is alive. The main daemon is prepared to work even without a database connection, so is perfectly safe if the Cron task to start it is executed even before the database process in the system startup, and it is also tolerant to database disconnections.
If for any reason the OTRS Daemon needs to be stop (for example during a system maintenance), all unhandled tasks are saved, and as soon as the process is started again it continues with all pending tasks. For recurring tasks it will only execute the last instance of the task (if its due time was during the downtime).
The OTRS Daemon is not visible in the OTRS Graphical User Interface unless it stops running.
When the system detects that the OTRS Daemon is not running, a notification is presented to a defined group of users ("admin" by default).
To disable the notification (not recommended), change or add the
notification groups, please edit the
Frontend::NotifyModule###800-Daemon-Check
setting in the SysConfig.
Clicking the notification the system presents an overlay window explaining the steps to bring the OTRS Daemon up and running.
The OTRS Daemon command line tools let you control the main daemon process (Start / Stop) or query its status. There are also tools to get more detailed information about the other four children daemons.
To start, stop or query daemon status bin/otrs.Daemon.pl
script
is used.
Example 4.30. Example to start the OTRS Daemon
shell> cd /opt/otrs/ shell> OTRS_HOME/bin/otrs.Daemon.pl start
Available Options
start - to start the OTRS Daemon process.
stop - to stop the OTRS Daemon process.
status - to query the OTRS Damon process status.
start --debug - to start the OTRS Daemon process in debug mode.
In this mode each daemon reports different messages depending on the actions that are been executed. This mode is not recommended for production environments.
stop --force - to stop the OTRS Daemon process in reducing the wait for children processes to finish.
A forced stop reduces the amount of time the main daemon waits to successful stop the other children processes from 30 seconds (normal) to 5 seconds (forced).
To list all configured child daemons that the main daemon should start and keep
running use the console command: Maint::Daemon::List
.
Example 4.31. Example to list all configured daemons
shell> cd /opt/otrs/ shell> bin/otrs.Console.pl Maint::Daemon::List
To list detailed information of all daemons use the console command:
Maint::Daemon::Summary
.
Example 4.32. Example to a summary of all daemon tasks
shell> cd /opt/otrs/ shell> bin/otrs.Console.pl Maint::Daemon::Summary