Double GenericAgent cron jobs

Moderator: crythias

Post Reply
gofster610
Znuny newbie
Posts: 5
Joined: 19 May 2010, 16:39
Znuny Version: 2.4.7

Double GenericAgent cron jobs

Post by gofster610 »

The issue I'm having is this. There are two entries for the 20 minute GenericAgent run in the cron job. Here's the output from crontab -u otrs -l :

# --
# cron/aaa_base - base crontab package
# Copyright (C) 2001-2009 xxx, http://otrs.org/
# --
# $Id: aaa_base.dist,v 1.7 2009/02/16 20:35:25 tr Exp $
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (AGPL). If you
# did not receive this file, see http://www.gnu.org/licenses/agpl.txt.
# --

# Who gets the cron emails?
MAILTO="root@localhost"
# --
# cron/fetchmail - fetchmail cron of the OTRS
# Copyright (C) 2001-2009 xxx, http://otrs.org/
# --
# $Id: fetchmail.dist,v 1.10 2009/02/16 20:53:10 tr Exp $
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (AGPL). If you
# did not receive this file, see http://www.gnu.org/licenses/agpl.txt.
# --

# fetch every 5 minutes emails via fetchmail
#*/5 * * * * [ -x /usr/bin/fetchmail ] && /usr/bin/fetchmail -a >> /dev/null
#*/5 * * * * /usr/bin/fetchmail -a --ssl >> /dev/null
# --
# cron/generic_agent - GenericAgent.pl cron of the OTRS
# Copyright (C) 2001-2009 xxx, http://otrs.org/
# --
# $Id: generic_agent.dist,v 1.12 2009/02/16 20:53:10 tr Exp $
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (AGPL). If you
# did not receive this file, see http://www.gnu.org/licenses/agpl.txt.
# --

# start generic agent every 20 minutes
*/20 * * * * $HOME/bin/GenericAgent.pl >> /dev/null

# example to execute GenericAgent.pl on 23:00 with
# Kernel::Config::GenericAgentMove job file
#0 23 * * * $HOME/bin/GenericAgent.pl -c "Kernel::Config::GenericAgentMove" >> /dev/null
# --
# cron/generic_agent - GenericAgent.pl cron of the OTRS
# Copyright (C) 2001-2009 xxx, http://otrs.org/
# --
# $Id: generic_agent.dist,v 1.12 2009/02/16 20:53:10 tr Exp $
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (AGPL). If you
# did not receive this file, see http://www.gnu.org/licenses/agpl.txt.
# --

# start generic agent every 20 minutes
*/20 * * * * $HOME/bin/GenericAgent.pl >> /dev/null

# example to execute GenericAgent.pl on 23:00 with
# Kernel::Config::GenericAgentMove job file
#0 23 * * * $HOME/bin/GenericAgent.pl -c "Kernel::Config::GenericAgentMove" >> /dev/null
# --
# cron/generic_agent - GenericAgent.pl cron of the OTRS
# Copyright (C) 2001-2009 xxx, http://otrs.org/
# --
# $Id: generic_agent-database.dist,v 1.8 2009/02/16 20:55:11 tr Exp $
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (AGPL). If you
# did not receive this file, see http://www.gnu.org/licenses/agpl.txt.
# --

# start generic agent every 10 minutes
*/10 * * * * $HOME/bin/GenericAgent.pl -c db >> /dev/null
# --
# cron/pending_jobs - pending_jobs cron of the OTRS
# Copyright (C) 2001-2009 xxx, http://otrs.org/
# --
# $Id: pending_jobs.dist,v 1.11 2009/02/16 20:55:11 tr Exp $
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (AGPL). If you
# did not receive this file, see http://www.gnu.org/licenses/agpl.txt.
# --

# check every 120 min the pending jobs
45 */2 * * * $HOME/bin/PendingJobs.pl >> /dev/null
# --
# cron/postmaster - postmaster cron of the OTRS
# Copyright (C) 2001-2009 xxx, http://otrs.org/
# --
# $Id: postmaster.dist,v 1.9 2009/02/16 20:55:11 tr Exp $
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (AGPL). If you
# did not receive this file, see http://www.gnu.org/licenses/agpl.txt.
# --

# check daily the spool directory of OTRS
#10 0 * * * * [ -e /etc/init.d/otrs ] && /etc/init.d/otrs cleanup >> /dev/null; [ -e /etc/rc.d/init.d/otrs ] && /etc/rc.d/init.d/otrs cleanup >> /dev/null
10 0 * * * $HOME/bin/otrs.cleanup >> /dev/null
# --
# cron/postmaster_mailbox - postmaster_mailbox cron of the OTRS
# Copyright (C) 2001-2009 xxx, http://otrs.org/
# --
# $Id: postmaster_mailbox.dist,v 1.2 2009/02/16 20:55:11 tr Exp $
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (AGPL). If you
# did not receive this file, see http://www.gnu.org/licenses/agpl.txt.
# --

# fetch emails every 2 minutes
*/2 * * * * $HOME/bin/PostMasterMailbox.pl >> /dev/null
# --
# cron/postmaster_mailbox - postmaster_mailbox cron of the OTRS
# Copyright (C) 2001-2009 xxx, http://otrs.org/
# --
# $Id: postmaster_mailbox.dist,v 1.2 2009/02/16 20:55:11 tr Exp $
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (AGPL). If you
# did not receive this file, see http://www.gnu.org/licenses/agpl.txt.
# --

# fetch emails every 10 minutes
*/10 * * * * $HOME/bin/PostMasterMailbox.pl >> /dev/null
# --
# cron/rebuild_ticket_index - rebuild ticket index for OTRS
# Copyright (C) 2001-2009 xxx, http://otrs.org/
# --
# $Id: rebuild_ticket_index.dist,v 1.9 2009/02/16 20:55:11 tr Exp $
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (AGPL). If you
# did not receive this file, see http://www.gnu.org/licenses/agpl.txt.
# --

# just every day
01 01 * * * $HOME/bin/RebuildTicketIndex.pl >> /dev/null
# --
# cron/session - delete old session ids of the OTRS
# Copyright (C) 2001-2009 xxx, http://otrs.org/
# --
# $Id: session.dist,v 1.11 2009/02/16 20:55:11 tr Exp $
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (AGPL). If you
# did not receive this file, see http://www.gnu.org/licenses/agpl.txt.
# --

# delete every 120 minutes old/idle session ids
55 */2 * * * $HOME/bin/DeleteSessionIDs.pl --expired >> /dev/null
# --
# cron/unlock - unlock old locked ticket of the OTRS
# Copyright (C) 2001-2009 xxx, http://otrs.org/
# --
# $Id: unlock.dist,v 1.10 2009/02/16 20:55:11 tr Exp $
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (AGPL). If you
# did not receive this file, see http://www.gnu.org/licenses/agpl.txt.
# --

# unlock every hour old locked tickets
35 * * * * $HOME/bin/UnlockTickets.pl --timeout >> /dev/null


I've checked the files in /opt/otrs/var/cron/ and have the following files:

aaa_base
fetchmail
generic_agent
generic_agent-database
pending jobs
postmaster
postmaster_mailbox
rebuild_ticket_index
session
unlock

I've check the generic_agent and generic_agent-database files. The first one has the entry:

# --
# cron/generic_agent - GenericAgent.pl cron of the OTRS
# Copyright (C) 2001-2009 xxx, http://otrs.org/
# --
# $Id: generic_agent.dist,v 1.12 2009/02/16 20:53:10 tr Exp $
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (AGPL). If you
# did not receive this file, see http://www.gnu.org/licenses/agpl.txt.
# --

# start generic agent every 20 minutes
*/20 * * * * $HOME/bin/GenericAgent.pl >> /dev/null

# example to execute GenericAgent.pl on 23:00 with
# Kernel::Config::GenericAgentMove job file
#0 23 * * * $HOME/bin/GenericAgent.pl -c "Kernel::Config::GenericAgentMove" >> /dev/nul

The second one has the following:

# --
# cron/generic_agent - GenericAgent.pl cron of the OTRS
# Copyright (C) 2001-2009 xxx, http://otrs.org/
# --
# $Id: generic_agent-database.dist,v 1.8 2009/02/16 20:55:11 tr Exp $
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (AGPL). If you
# did not receive this file, see http://www.gnu.org/licenses/agpl.txt.
# --

# start generic agent every 10 minutes
*/10 * * * * $HOME/bin/GenericAgent.pl -c db >> /dev/null

So, the files look fine. I'm just not understanding how the cron job is getting the two entries for the same job. I've tried stopping and restarting the cron job using the ./Cron.sh stop otrs and ./Cron.sh restart otrs, and the second entry always shows up. Any ideas?
crythias
Moderator
Posts: 10169
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Double GenericAgent cron jobs

Post by crythias »

crontab -e edits the crontab.
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
gofster610
Znuny newbie
Posts: 5
Joined: 19 May 2010, 16:39
Znuny Version: 2.4.7

Re: Double GenericAgent cron jobs

Post by gofster610 »

I've edited the crontab file to remove the duplicate entry. The issue is that if I restart the server or rebuild the crontab using ./Cron.sh restart otrs, then the duplicate entry comes back and I have to remove it once again.

I'm hoping to find a long term solution to the issue instead of a work around. Thanks for the input though :)
jojo
Znuny guru
Posts: 15020
Joined: 26 Jan 2007, 14:50
Znuny Version: Git Master
Contact:

Re: Double GenericAgent cron jobs

Post by jojo »

Have a look in all files in var/cron/ it seems that one is double from the content... (Perhaps a mistake during installation?)
"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
gofster610
Znuny newbie
Posts: 5
Joined: 19 May 2010, 16:39
Znuny Version: 2.4.7

Re: Double GenericAgent cron jobs

Post by gofster610 »

Ok,

I figured it out. When I edited the files in /opt/otrs/var/cron/ , a hidden backup file was also being created in the directory. So, I had generic-agent and generic-agent~ . When the crontab was re-created, it was using both the current file and the backup file causing me to have two different generic agents running.

So, that's pretty wacky, but I'm glad I got it resolved.
Post Reply