otrs.Scheduler.pl & systemd

Moderator: crythias

Locked
Niels2570
Znuny newbie
Posts: 20
Joined: 16 May 2011, 15:11
Znuny Version: 3.3.11
Real Name: Niels

otrs.Scheduler.pl & systemd

Post by Niels2570 »

Hi,

I am running OTRS 3.3.11 on RHEL 7.1 and I am having problems with my systemd startup script for the otrs-scheduler.

When I start OTRS & the Scheduler it works fine :

Code: Select all

systemctl start otrs-scheduler.service
systemctl status otrs-scheduler.service
otrs-scheduler.service - OTRS Scheduler                      
   Loaded: loaded (/usr/lib/systemd/system/otrs-scheduler.service; enabled)
   Active: active (running) since Thu 2015-03-26 08:39:11 CET; 29s ago     
  Process: 20032 ExecStop=/usr/bin/perl /opt/otrs/bin/otrs.Scheduler.pl -a stop (code=exited, status=1/FAILURE)
  Process: 20961 ExecStart=/usr/bin/perl /opt/otrs/bin/otrs.Scheduler.pl -a start -f 1 (code=exited, status=0/SUCCESS)
 Main PID: 20964 (perl)                                                                                               
   CGroup: /system.slice/otrs-scheduler.service                                                                       
           └─20964 /usr/bin/perl /opt/otrs/bin/otrs.Scheduler.pl -a start -f 1                                        

Mar 26 08:39:10 helpdesk systemd[1]: Starting OTRS Scheduler...
Mar 26 08:39:11 helpdesk OTRS-otrs.Scheduler-10[20964]: [Notice][main::_Start] Scheduler Daemon start! PID 20964
Mar 26 08:39:11 helpdesk systemd[1]: Started OTRS Scheduler.   
I check the process and it's there :

Code: Select all

apache   20964     1  4 08:39 ?        00:00:00 /usr/bin/perl /opt/otrs/bin/otrs.Scheduler.pl -a start -f 1

But then after some minutes when the Scheduler does his status check, he stops the perfectly running Scheduler and says that the process
is not in the MySQL table and starts a new one ? (This process is in the database !, I checked the process_id table)

Code: Select all

Mar 26 08:40:03 helpdesk OTRS-otrs.Scheduler-10[21023]: [Debug][main::_Status][610] Scheduler Daemon status request! PID 20964
Mar 26 08:40:03 helpdesk OTRS-otrs.Scheduler-10[21023]: [Notice][main::_Stop] Scheduler Daemon Stop! PID 20964
Mar 26 08:40:03 helpdesk OTRS-otrs.Scheduler-10[20964]: [Error][main::_AutoStop][Line:685]: Process could not be found in the process table!
Scheduler is stopping...!
Mar 26 08:40:06 helpdesk OTRS-otrs.Scheduler-10[21060]: [Notice][main::_Start] Scheduler Daemon start! PID 21060
The process 20964 is in the database :

Code: Select all

+----------------+------------+------------------+----------------+----------------+
| process_name   | process_id | process_host     | process_create | process_change |
+----------------+------------+------------------+----------------+----------------+
| otrs.Scheduler | 20964      | helpdesk etc. |     1427355551 |     1427355551 |
+----------------+------------+------------------+----------------+----------------+
So my systemctl tells me it failed but the Scheduler runs in a new process.

Code: Select all

otrs-scheduler.service                                                                           loaded failed failed    OTRS Scheduler

Code: Select all

systemctl status otrs-scheduler.service
otrs-scheduler.service - OTRS Scheduler
   Loaded: loaded (/usr/lib/systemd/system/otrs-scheduler.service; enabled)
   Active: failed (Result: exit-code) since Thu 2015-03-26 08:40:04 CET; 13min ago
  Process: 21053 ExecStop=/usr/bin/perl /opt/otrs/bin/otrs.Scheduler.pl -a stop (code=exited, status=1/FAILURE)
  Process: 20961 ExecStart=/usr/bin/perl /opt/otrs/bin/otrs.Scheduler.pl -a start -f 1 (code=exited, status=0/SUCCESS)
 Main PID: 20964 (code=exited, status=1/FAILURE)

Mar 26 08:39:10 helpdesk systemd[1]: Starting OTRS Scheduler...
Mar 26 08:39:11 helpdesk OTRS-otrs.Scheduler-10[20964]: [Notice][main::_Start] Scheduler Daemon start! PID 20964
Mar 26 08:39:11 helpdesk systemd[1]: Started OTRS Scheduler.
Mar 26 08:40:03 helpdesk OTRS-otrs.Scheduler-10[20964]: [Error][main::_AutoStop][Line:685]: Process could not be found in the process table!
                                                        Scheduler is stopping...!
Mar 26 08:40:03 helpdesk systemd[1]: otrs-scheduler.service: main process exited, code=exited, status=1/FAILURE
Mar 26 08:40:04 helpdesk perl[21053]: Can't stop OTRS Scheduler because is not running!
Mar 26 08:40:04 helpdesk systemd[1]: otrs-scheduler.service: control process exited, code=exited status=1
Mar 26 08:40:04 helpdesk systemd[1]: Unit otrs-scheduler.service entered failed state.
Anyone who has an idea on how to fix this ?

Regards,
Niels

My systemd startup script :

Code: Select all

[Unit]
Description=OTRS Scheduler

[Service]
Type=forking
WorkingDirectory=/opt/otrs
User=apache
ExecStart=/usr/bin/perl /opt/otrs/bin/otrs.Scheduler.pl -a start -f 1
ExecReload=/usr/bin/perl /opt/otrs/bin/otrs.Scheduler.pl -a stop : /usr/bin/perl /opt/otrs/bin/otrs.Scheduler.pl -a start -f 1
ExecStop=/usr/bin/perl /opt/otrs/bin/otrs.Scheduler.pl -a stop
PrivateTmp=true

TimeoutSec=300

[Install]
WantedBy=multi-user.target
Niels2570
Znuny newbie
Posts: 20
Joined: 16 May 2011, 15:11
Znuny Version: 3.3.11
Real Name: Niels

Re: otrs.Scheduler.pl & systemd

Post by Niels2570 »

it seems to be normal behaviour to restart itself from the scheduler
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.
Locked