Tony Upson's picture

Question: When I navigate to WebAdmn --> Scheduled Cron Jobs...

I see a list of jobs pre-created that have 'test' at the beginning. Are these cronjobs live or in some sort of test mode?

Reason I ask is because my OTRS is notifying me of a job (that is listed in the scheduled cronjobs) is not running:

Forum: 
Tags: 
Tony Upson's picture

i am going to say that was a SPAM reply as it had nothing to do with my post. At anyrate, I assume the 'Test -x' before all the jobs are putting it in test mode? Do I need to remove them to enforce their actual use?

- Tony

Network Engineer

Federal Gov't

Jeremy Davis's picture

I deleted the spam. Also I'm sure I wrote a response to this yesterday! I must have hit "preview" instead of "save" - doh!

Anyway, the "test -x" just means that it's testing if the scripts are executable before it tries to execute them.

I'd be looking in the logs (in /var/logs should hopefully be a otrs directory of file)

Tony Upson's picture

What does this command execute?

 

test -d /run/otrs || mkdir -p /run/otrs && chown otrs:www-data /run/otrs && chmod 770 /run/otrs

- Tony

Network Engineer

Federal Gov't

Jeremy Davis's picture

"test" I explained above; "-d" is for directory

"||" is the 'OR' logic operator; code after that only executes if the command before it fails (non-zero exit code)

"mkdir" makes a directory

"&&" is the logic 'AND' operator; code after that only executes if the command before it succeeds (exit code zero).

"chown user:group /path" is 'change ownership' of /path to user:group; in this case to user "otrs" and group "www-data" (the webserver group)

"chmod xxx /path" is 'change mode' (i.e. permissions). This is a little more complicated (and you can google if you're particularly interested) but the 3 numbers refer to user:group;everybody and 7 means all privileges. So essentially it means that the user and the group have full rights to the directory.

So the full thing in English is:

Does the directory /run/otrs exist? If so great; go to the next line. If not then make it and set the owner to the user "otrs" and group "www-data" (webserver); also give them full rights...

Tony Upson's picture

not sure its use then, be it that directory is empty...

- Tony

Network Engineer

Federal Gov't

Jeremy Davis's picture

It should contain a pid (process ID) file and/or a lock file while OTRS is running.
Tony Upson's picture

For the love of me, i cannot get this scheduler to remain running, every few hours i receive the same error. all google searches point to otrs folder paths that do not match up with this ISO. perhaps this ISO isnt as polished as i would have thought, as I am running into more and more OTRS issues as I go along, since directories that files are looking for arent in the same location(s) specified. :(

 

 

- Tony

Network Engineer

Federal Gov't

Jeremy Davis's picture

I imagine that the upstream instructions relate to an install from source. In the TurnKey Linux OTRS appliance the packages come from the Debian repositories. Because they are packaged by Debian then they are more tightly integrated into the OS than what a source install would be.

Have you looked at the log files? That would be the first place to start IMO (I'd look for a file called otrs.log or similar in /var/log). The next thing to look at is the settings (probably /etc/otrs or similar). From my brief googling it seems that the scheduler should be running as a daemon so there should definitely be a log file somewhere.

I'm really snowed under with updating the optimised builds at the moment but as sopon as I have time I will sit down and have a closer look at this...

Jeremy Davis's picture

And from what I can gather the scheduler seems to be running fine on mine. The server hasn't been running that long (about an hour) but it's definitely running...
ps aux | grep otrs


otrs      4293  0.1  2.1 159048 21980 ?        S    12:35   0:04 /usr/bin/perl /usr/share/otrs/bin/otrs.Scheduler.pl -w 1
root      7098  0.0  0.1  11124  1080 pts/1    S+   13:26   0:00 grep --color=auto otrs
(the second mention is the command that I just used showing up as a running process)

It is also mentioned in the OTRS logs (within the Admin web interface). Also I see that there isn't a /var/log/otrs.log as I was expecting. However there are quite a few entries in the syslog which suggest that it's working how it should (I'm guessing that all these entries are OTRS checking that it's running!?); e.g.:

/var/log/syslog:Oct 14 12:35:01 otrs CRON[4280]: (otrs) CMD (test -x $HOME/bin/otrs.Scheduler.pl && $HOME/bin/otrs.Scheduler.pl -w 1 >> /dev/null)
/var/log/syslog:Oct 14 12:35:02 otrs OTRS-otrs.Scheduler-10[4293]: [Notice][main::_Start] Scheduler Daemon start! PID 4293
/var/log/syslog:Oct 14 12:40:01 otrs CRON[4583]: (otrs) CMD (test -x $HOME/bin/otrs.Scheduler.pl && $HOME/bin/otrs.Scheduler.pl -w 1 >> /dev/null)
/var/log/syslog:Oct 14 12:40:02 otrs OTRS-otrs.Scheduler-10[4585]: [Notice][main::_Status] Scheduler Daemon status request! PID 4293
/var/log/syslog:Oct 14 12:45:01 otrs CRON[4681]: (otrs) CMD (test -x $HOME/bin/otrs.Scheduler.pl && $HOME/bin/otrs.Scheduler.pl -w 1 >> /dev/null)
/var/log/syslog:Oct 14 12:45:02 otrs OTRS-otrs.Scheduler-10[4684]: [Notice][main::_Status] Scheduler Daemon status request! PID 4293
/var/log/syslog:Oct 14 12:50:01 otrs CRON[5184]: (otrs) CMD (test -x $HOME/bin/otrs.Scheduler.pl && $HOME/bin/otrs.Scheduler.pl -w 1 >> /dev/null)
/var/log/syslog:Oct 14 12:50:02 otrs OTRS-otrs.Scheduler-10[5189]: [Notice][main::_Status] Scheduler Daemon status request! PID 4293
/var/log/syslog:Oct 14 12:55:01 otrs CRON[5791]: (otrs) CMD (test -x $HOME/bin/otrs.Scheduler.pl && $HOME/bin/otrs.Scheduler.pl -w 1 >> /dev/null)
/var/log/syslog:Oct 14 12:55:01 otrs OTRS-otrs.Scheduler-10[5793]: [Notice][main::_Status] Scheduler Daemon status request! PID 4293
/var/log/syslog:Oct 14 13:00:01 otrs CRON[6433]: (otrs) CMD (test -x $HOME/bin/otrs.Scheduler.pl && $HOME/bin/otrs.Scheduler.pl -w 1 >> /dev/null)
/var/log/syslog:Oct 14 13:00:02 otrs OTRS-otrs.Scheduler-10[6437]: [Notice][main::_Status] Scheduler Daemon status request! PID 4293
/var/log/syslog:Oct 14 13:05:01 otrs CRON[6752]: (otrs) CMD (test -x $HOME/bin/otrs.Scheduler.pl && $HOME/bin/otrs.Scheduler.pl -w 1 >> /dev/null)
/var/log/syslog:Oct 14 13:05:01 otrs OTRS-otrs.Scheduler-10[6753]: [Notice][main::_Status] Scheduler Daemon status request! PID 4293
/var/log/syslog:Oct 14 13:10:01 otrs CRON[6887]: (otrs) CMD (test -x $HOME/bin/otrs.Scheduler.pl && $HOME/bin/otrs.Scheduler.pl -w 1 >> /dev/null)
/var/log/syslog:Oct 14 13:10:01 otrs OTRS-otrs.Scheduler-10[6891]: [Notice][main::_Status] Scheduler Daemon status request! PID 4293
/var/log/syslog:Oct 14 13:15:01 otrs CRON[6973]: (otrs) CMD (test -x $HOME/bin/otrs.Scheduler.pl && $HOME/bin/otrs.Scheduler.pl -w 1 >> /dev/null)
/var/log/syslog:Oct 14 13:15:01 otrs OTRS-otrs.Scheduler-10[6976]: [Notice][main::_Status] Scheduler Daemon status request! PID 4293
/var/log/syslog:Oct 14 13:20:01 otrs CRON[7035]: (otrs) CMD (test -x $HOME/bin/otrs.Scheduler.pl && $HOME/bin/otrs.Scheduler.pl -w 1 >> /dev/null)
/var/log/syslog:Oct 14 13:20:02 otrs OTRS-otrs.Scheduler-10[7039]: [Notice][main::_Status] Scheduler Daemon status request! PID 4293
/var/log/syslog:Oct 14 13:25:01 otrs CRON[7084]: (otrs) CMD (test -x $HOME/bin/otrs.Scheduler.pl && $HOME/bin/otrs.Scheduler.pl -w 1 >> /dev/null)
/var/log/syslog:Oct 14 13:25:01 otrs OTRS-otrs.Scheduler-10[7087]: [Notice][main::_Status] Scheduler Daemon status request! PID 4293
/var/log/syslog:Oct 14 13:30:01 otrs CRON[7166]: (otrs) CMD (test -x $HOME/bin/otrs.Scheduler.pl && $HOME/bin/otrs.Scheduler.pl -w 1 >> /dev/null)
/var/log/syslog:Oct 14 13:30:01 otrs OTRS-otrs.Scheduler-10[7170]: [Notice][main::_Status] Scheduler Daemon status request! PID 4293

I'm a bout to go to bed but I'll leave it running overnight and see how it is in the morning.

Tony Upson's picture

my ps aux | grep otrs shows the following

otrs      3391  0.1  0.3 158700 21644 ?        S    18:18   0:00 /usr/bin/perl /usr/share/otrs/bin/otrs.Scheduler.pl -a start
root      3395  0.0  0.0  11120  936 tty1    S+   18:19   0:00 grep --color=auto otrs

I noticed my otrs.Scheduler.pl has -a start (yours has -w 1)

I noticed my root line has ttyl (yours has pts/1)

Not sure if those mean anything and/or if they should be changed.

- Tony

Network Engineer

Federal Gov't

Tony Upson's picture

It does appear the Schedule is running, however, I am seeing these lines within the syslog:

Oct 14 00:07:37 <localhost> OTRS-otrs.Scheduler-16[1553]: [Notice][main::_AutoRestart] Config.pm changed, unsafe to continue! #012Scheduler is restarting...!
Oct 14 00:07:38 <localhost> OTRS-otrs.Scheduler-16[1770]: [Notice][main::_Start] Scheduler Daemon start! PID 1770
Oct 14 00:09:22 <localhost> OTRS-otrs.Scheduler-16[1770]: [Notice][main::_AutoRestart] Config.pm changed, unsafe to continue! #012Scheduler is restarting...!
Oct 14 00:09:22 <localhost> OTRS-otrs.Scheduler-16[1800]: [Notice][main::_Start] Scheduler Daemon start! PID 1800

----

Oct 14 18:15:01 <localhost> CRON[3336]: (otrs) CMD (test -x $HOME/bin/otrs.Scheduler.pl && $HOME/bin/otrs.Scheduler.pl -w 1 >> /dev/null)
Oct 14 18:15:02 <localhost> OTRS-otrs.Scheduler-16[3338]: [Notice][main::_Status] Scheduler Daemon status request! PID 1549
Oct 14 18:17:01 <localhost> CRON[3365]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)
Oct 14 18:17:01 <localhost> OTRS-otrs.Scheduler-16[1549]: [Notice][main::_AutoRestart] Config.pm changed, unsafe to continue! #012Scheduler is restarting...!
Oct 14 18:17:02 <localhost> OTRS-otrs.Scheduler-16[3370]: [Notice][main::_Start] Scheduler Daemon start! PID 3370
Oct 14 18:17:04 <localhost> OTRS-otrs.Scheduler-16[3370]: [Notice][main::_AutoRestart] Config.pm changed, unsafe to continue! #012Scheduler is restarting...!
Oct 14 18:17:04 <localhost> OTRS-otrs.Scheduler-16[3374]: [Notice][main::_Start] Scheduler Daemon start! PID 3374
Oct 14 18:17:11 <localhost> OTRS-otrs.Scheduler-16[3374]: [Notice][main::_AutoRestart] Config.pm changed, unsafe to continue! #012Scheduler is restarting...!
Oct 14 18:17:11 <localhost> OTRS-otrs.Scheduler-16[3378]: [Notice][main::_Start] Scheduler Daemon start! PID 3378
Oct 14 18:17:13 <localhost> OTRS-otrs.Scheduler-16[3378]: [Notice][main::_AutoRestart] Config.pm changed, unsafe to continue! #012Scheduler is restarting...!
Oct 14 18:17:13 <localhost> OTRS-otrs.Scheduler-16[3382]: [Notice][main::_Start] Scheduler Daemon start! PID 3382
Oct 14 18:17:34 <localhost> OTRS-CGI-16[2844]: [Error][Kernel::System::Spelling::Check][Line:149]: Can't find spellchecker (/usr/bin/aspell): No such file or directory
Oct 14 18:18:09 <localhost> OTRS-otrs.Scheduler-16[3382]: [Notice][main::_AutoRestart] Config.pm changed, unsafe to continue! #012Scheduler is restarting...!
Oct 14 18:18:10 <localhost> OTRS-otrs.Scheduler-16[3387]: [Notice][main::_Start] Scheduler Daemon start! PID 3387
Oct 14 18:18:12 <localhost> OTRS-otrs.Scheduler-16[3387]: [Notice][main::_AutoRestart] Config.pm changed, unsafe to continue! #012Scheduler is restarting...!
Oct 14 18:18:12 <localhost> OTRS-otrs.Scheduler-16[3391]: [Notice][main::_Start] Scheduler Daemon start! PID 3391

 

It would seem as though it stops if configuration changes are made or something. It restarts when I bounce the node or after a period of idle time. Thoughts/Confirm?

 

- Tony

Network Engineer

Federal Gov't

Tony Upson's picture

Service stopped again, tried to manually start it, received:

Wed Oct 14 21:26:46 2015	error	OTRS-otrs.Scheduler-16	Process could not be found in the process table!
Wed Oct 14 21:26:46 2015	notice	OTRS-otrs.Scheduler-16	Scheduler Daemon start! PID 2069
Wed Oct 14 21:26:46 2015	error	OTRS-otrs.Scheduler-16	NOTICE: otrs.Scheduler.pl is registered in the DB, but the registry has not been updated in 3704 seconds!. The registration will be deleted so the Scheduler can start again without forcing

It would also appear that if this isnt running, my "Fetch E-mail" cronjob doesn't run every 5 minutes; which poses an issue on my Help Desk Tickets.

This appears to be an issue here.

- Tony

Network Engineer

Federal Gov't

Tony Upson's picture

All week this notification is listed at the top of the page:

However, when I review the system log, it appears to be runnning?

Fri Oct 16 17:20:02 2015 notice OTRS-otrs.GenericAgent.pl-16 Run GenericAgent Job 'trigger escalation events' from config file. 
Fri Oct 16 17:20:02 2015 notice OTRS-otrs.GenericAgent.pl-16 Run GenericAgent Job 'send escalation notifications' from config file.
Fri Oct 16 17:20:01 2015 notice OTRS-otrs.Scheduler-16 Scheduler Daemon status request! PID 14996
Fri Oct 16 17:15:02 2015 notice OTRS-otrs.Scheduler-16 Scheduler Daemon status request! PID 14996
Fri Oct 16 17:10:02 2015 notice OTRS-otrs.Scheduler-16 Scheduler Daemon status request! PID 14996 
Fri Oct 16 17:05:01 2015 notice OTRS-otrs.Scheduler-16 Scheduler Daemon status request! PID 14996 
Fri Oct 16 17:00:02 2015 notice OTRS-otrs.GenericAgent.pl-16 Run GenericAgent Job 'trigger escalation events' from config file. 
Fri Oct 16 17:00:02 2015 notice OTRS-otrs.GenericAgent.pl-16 Run GenericAgent Job 'send escalation notifications' from config file.
Fri Oct 16 17:00:01 2015 notice OTRS-otrs.Scheduler-16 Scheduler Daemon status request! PID 14996 
Fri Oct 16 16:55:01 2015 notice OTRS-otrs.Scheduler-16 Scheduler Daemon status request! PID 14996
Fri Oct 16 16:50:01 2015 notice OTRS-otrs.Scheduler-16 Scheduler Daemon status request! PID 14996
Fri Oct 16 16:45:01 2015 notice OTRS-otrs.Scheduler-16 Scheduler Daemon status request! PID 14996

- Tony

Network Engineer

Federal Gov't

Tony Upson's picture

bump...

- Tony

Network Engineer

Federal Gov't

Jeremy Davis's picture

From the look of your logs it looks like it's running. I also note that even the warning itself isn't sure: "may not be running"...

From what I can see the warning can be safely ignored. Although TBH as I've said I'm not OTRS expert so I can't comment further...

Tony Upson's picture

 The Debian 8 OS itself doesnt appear to have a cronjob for the Scheduler: 

: crontab -l -u otrs | grep Scheduler
: no crontab for otrs

But within Webmin there is a cronjob configured for OTRS services.

test -x $HOME/bin/otrs.Scheduler.pl && $HOME/bin/otrs.Scheduler.pl -w 1 >> /dev/null

This job was defaulted to run every 5 minutes, but this also appears to be overkill for its use in my Agency. I have since adjusted thist to every 15 minutes (may even up it to 30 minutes).

The way I seemed to bandaid this issue on my appliance is just to reduce the restart timer within OTRS GUI (SysConfig --> Scheduler --> Core) "Scheduler::RestartAfterSeconds" from the default of 86400 (24hrs) to 3600 (1hr); so that it auto restarts every 1hr if there are any failures/stops in between.


Thus, down time (if there is any from the warning to begin with) is cleared/reset every hour.

- Tony

Network Engineer

Federal Gov't

Jeremy Davis's picture

Thanks for posting back with that info. That will no doubt be useful for others.

Re the "missing" cron job. I suspect that it is because each user has a crontab file. So by default you are probably only checking root's. WHereas the OTRS schedulaer is using the otrs user account crontab file. Although that must mean that by default Webmin collect's crontab info from all users (which would make sense but I didn't realise that it's that smart!)

Add new comment