(SOVED) Cron not working

Moderator: crythias

Locked
KasumiNinja
Znuny newbie
Posts: 11
Joined: 07 Jul 2013, 17:45
Znuny Version: 3.2.8

(SOVED) Cron not working

Post by KasumiNinja »

I have a new install on scientific linux. Both the mail fetch cronjob as a manually configured cronjob to delete tickets from the junk queue doesn't run. Running both cron jobs manually from the admin interface work fine. Any ideas what might be the problem? The log file doesn't show any error messages.
Last edited by KasumiNinja on 10 Jul 2013, 17:14, edited 1 time in total.
tto
Znuny wizard
Posts: 315
Joined: 09 Jan 2007, 15:24
Znuny Version: OTRS 5.0.x
Real Name: Torsten
Company: c.a.p.e. IT GmbH
Location: Chemnitz
Contact:

Re: Cron not working

Post by tto »

KasumiNinja wrote:I have a new install on scientific linux. Both the mail fetch cronjob as a manually configured cronjob to delete tickets from the junk queue doesn't run. Running both cron jobs manually from the admin interface work fine. Any ideas what might be the problem?
I don't hink it's an OTRS problem. It's more likely that something is wrong how the crontab is set up.

(1) Is there a chance for missing environment variables/settings in the users crontab?
(2) Are you using the wrong crontab (wrong user)?
(3) Did you use bin/Cron.sh to setup the crontab and did you enable var/cron/aaa_base?

regards, T.
--
KIX 17.x (fork of OTRS)
Professional KIX-, or OTRS-integration, development and consulting by c.a.p.e. IT - http://www.cape-it.de
For questions and hints regarding KIX(4OTRS) please go to https://forum.kixdesk.com/
Bei Fragen und Hinweisen zu KIX(4OTRS) bitte an https://forum.kixdesk.com/ wenden.
KasumiNinja
Znuny newbie
Posts: 11
Joined: 07 Jul 2013, 17:45
Znuny Version: 3.2.8

Re: Cron not working

Post by KasumiNinja »

Thanks for the help, are the manual steps required to activate cron after the rpm installation? I thought this was only for the manual installation:

http://doc.otrs.org/3.2/en/html/manual- ... l#cronjobs

Code: Select all

# crontab -l -u otrs
no crontab for otrs

Code: Select all

# ls -l /opt/
total 4
drwxrwxr-x 8 otrs apache 4096 jul  7 18:06 otrs

Code: Select all

# su otrs
# whoami
root
tto
Znuny wizard
Posts: 315
Joined: 09 Jan 2007, 15:24
Znuny Version: OTRS 5.0.x
Real Name: Torsten
Company: c.a.p.e. IT GmbH
Location: Chemnitz
Contact:

Re: Cron not working

Post by tto »

KasumiNinja wrote:Thanks for the help, are the manual steps required to activate cron after the rpm installation? I thought this was only for the manual installation:
http://doc.otrs.org/3.2/en/html/manual- ... l#cronjobs
Sorry - I don't know about the rpm-installation since I prefer installation from source. It may be a bug or rather a missing functionality. However, theempty crontab is your problem.

regards, T.
--
KIX 17.x (fork of OTRS)
Professional KIX-, or OTRS-integration, development and consulting by c.a.p.e. IT - http://www.cape-it.de
For questions and hints regarding KIX(4OTRS) please go to https://forum.kixdesk.com/
Bei Fragen und Hinweisen zu KIX(4OTRS) bitte an https://forum.kixdesk.com/ wenden.
KasumiNinja
Znuny newbie
Posts: 11
Joined: 07 Jul 2013, 17:45
Znuny Version: 3.2.8

Re: Cron not working

Post by KasumiNinja »

I would like to start ./Cron.sh manually. However I can't change into the otrs user. Any ideas what might be the problem?

Code: Select all

# su otrs
# whoami
root 
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Cron not working

Post by crythias »

bin/Cron.sh start otrs
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
KasumiNinja
Znuny newbie
Posts: 11
Joined: 07 Jul 2013, 17:45
Znuny Version: 3.2.8

Re: Cron not working

Post by KasumiNinja »

crythias wrote:bin/Cron.sh start otrs
Thanks, the problem though is that I can't issue 'su otrs' first. The is likely because of the otrs users shell is pointing to /bin/false
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Cron not working

Post by crythias »

did you try this? because if you read the warning it says:
Run this script just as OTRS user! Or use 'Cron.sh {start|stop|restart} OTRS_USER' as root!
and that means, explicitly:
crythias wrote:bin/Cron.sh start otrs
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
KasumiNinja
Znuny newbie
Posts: 11
Joined: 07 Jul 2013, 17:45
Znuny Version: 3.2.8

Re: Cron not working

Post by KasumiNinja »

Where did you find these instructions? The manual explicitly mentions you need to login as the otrs user:
To setup all cron jobs, the script bin/Cron.sh located in the home directory of the 'otrs' user can be used. When this script is executed, it needs a parameter to specify whether you want to install, remove, or reinstall the cron jobs. The following parameters can be used:

Cron.sh { start } { stop } { restart } [ OTRS user ]

Because the cron jobs need to be installed in the crontab file of the 'otrs' user, you need to be logged in as 'otrs'. If you are logged in as root, you can switch to 'otrs' with the command su otrs. Execute the commands specified in Script below to install the cron jobs.
http://doc.otrs.org/3.2/en/html/manual- ... l#cronjobs
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Cron not working

Post by crythias »

I got these instructions from within Cron.sh

But I could have gotten them from the documentation which you just quoted. (ignoring the information which follows the commandline.)
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
KasumiNinja
Znuny newbie
Posts: 11
Joined: 07 Jul 2013, 17:45
Znuny Version: 3.2.8

Re: Cron not working

Post by KasumiNinja »

I solved this by starting an stopping otrs:

Code: Select all

# service otrs stop
Shutting down OTRS 
 Disable /opt/otrs/bin/otrs.PostMaster.pl ... done.
 Shutting down cronjobs ...
no crontab for otrs
 failed!

Code: Select all

# service otrs start
Starting OTRS..
 Checking httpd ... done.
 Checking database connection... Trying to connect to database
...
Connected.
 done.
 Starting OTRS Scheduler Service...  done.
 Enable /opt/otrs/bin/otrs.PostMaster.pl ... done.
 Checking otrs spool dir...  done.
 Creating cronjobs (source /opt/otrs/var/cron/*) ...
 done.
Locked