Agent schedule from cron

Moderator: crythias

Locked
makgab
Znuny newbie
Posts: 28
Joined: 19 Oct 2014, 16:21
Znuny Version: 3.3.9
Real Name: Gábor

Agent schedule from cron

Post by makgab »

Hi!

How can I run the agent in cron? The agent is running manually. I would like to run it from cron (centos7).
I set the agent: delete tickets in the junk queue. It is ok:
http://blog.otrs.org/2011/08/04/otrs-ti ... nt-page-1/

I copied the generic_agent file into directory "/etc/cron.d":

Code: Select all

HOME=/opt/otrs
# start generic agent every hour 20 minutes
20 * * * *  root  $HOME/bin/otrs.GenericAgent.pl >> /dev/null
What do I need to set up?
--
G.

RedHat/CentOS/Fedora
jojo
Znuny guru
Posts: 15020
Joined: 26 Jan 2007, 14:50
Znuny Version: Git Master
Contact:

Re: Agent schedule from cron

Post by jojo »

read the INSTALL.md) instructions!
"Production": OTRS™ 8, OTRS™ 7, STORM powered by OTRS
"Testing": ((OTRS Community Edition)) and git Master

Never change Defaults.pm! :: Blog
Professional Services:: http://www.otrs.com :: enjoy@otrs.com
makgab
Znuny newbie
Posts: 28
Joined: 19 Oct 2014, 16:21
Znuny Version: 3.3.9
Real Name: Gábor

Re: Agent schedule from cron

Post by makgab »

I see the INSTALL file.

In logwatch I found:

Code: Select all

--------------------- Cron Begin ------------------------ 

 Files with bad mode:
    /etc/cron.d/otrs_scheduler_watchdog
    /etc/cron.d/otrs_generic_agent
 
  ---------------------- Cron End ------------------------- 

-rw-r--r--. 1 root root otrs_generic_agent
-rw-r--r--. 1 root root otrs_postmaster_mailbox
-rw-r--r--. 1 root root otrs_scheduler_watchdog


The "otrs_postmaster_mailbox" works fine.
--
G.

RedHat/CentOS/Fedora
jojo
Znuny guru
Posts: 15020
Joined: 26 Jan 2007, 14:50
Znuny Version: Git Master
Contact:

Re: Agent schedule from cron

Post by jojo »

"Production": OTRS™ 8, OTRS™ 7, STORM powered by OTRS
"Testing": ((OTRS Community Edition)) and git Master

Never change Defaults.pm! :: Blog
Professional Services:: http://www.otrs.com :: enjoy@otrs.com
makgab
Znuny newbie
Posts: 28
Joined: 19 Oct 2014, 16:21
Znuny Version: 3.3.9
Real Name: Gábor

Re: Agent schedule from cron

Post by makgab »

The schedule cron scripts:

Code: Select all

#  /etc/cron.d/otrs_generic_agent
HOME=/opt/otrs
# start generic agent every hour 20 minutes
20 * * * *  root  $HOME/bin/otrs.GenericAgent.pl >> /dev/null

# /etc/cron.d/otrs_generic_agent-database
HOME=/opt/otrs
# start generic agent every 10 minutes
*/10 * * * *  root  $HOME/bin/otrs.GenericAgent.pl -c db >> /dev/null
The agent is not running automatically. (Just manual from web interface).
What do I missing?
--
G.

RedHat/CentOS/Fedora
reneeb
Znuny guru
Posts: 5018
Joined: 13 Mar 2011, 09:54
Znuny Version: 6.0.x
Real Name: Renée Bäcker
Company: Perl-Services.de
Contact:

Re: Agent schedule from cron

Post by reneeb »

Any error messages in the log file? Which user run the cronjobs? Do you run them as otrs user or webserver user or root?
Perl / Znuny development: http://perl-services.de
Free Znuny add ons from the community: http://opar.perl-services.de
Commercial add ons: http://feature-addons.de
makgab
Znuny newbie
Posts: 28
Joined: 19 Oct 2014, 16:21
Znuny Version: 3.3.9
Real Name: Gábor

Re: Agent schedule from cron

Post by makgab »

reneeb wrote:Any error messages in the log file? Which user run the cronjobs? Do you run them as otrs user or webserver user or root?
The cron runs as root. There are not any error message in log.
If I run manually (as root):

Code: Select all

~# /opt/otrs/bin/otrs.GenericAgent.pl -c db

~# /opt/otrs/bin/otrs.GenericAgent.pl
Job: 'send escalation notifications'
Job: 'trigger escalation events'
So, no error, but my Job is not running. :o
--
G.

RedHat/CentOS/Fedora
makgab
Znuny newbie
Posts: 28
Joined: 19 Oct 2014, 16:21
Znuny Version: 3.3.9
Real Name: Gábor

Re: Agent schedule from cron

Post by makgab »

I see that if I run as root:

Code: Select all

/opt/otrs/bin/Cron.sh start otrs
then it works fine. :)
--
G.

RedHat/CentOS/Fedora
Locked