This plugin allows you to report an issue in MantisBT by sending an email to a particular mail account
Moderators: Developer , Contributor
nolankam
Posts: 9 Joined: 30 Dec 2018, 07:33
Post
by nolankam » 07 Jan 2019, 14:57
I have checked and confirmed that my configuration for the mailbox is correct by executing the bug_report_mail.php on command prompt (I am using the Bitnami package running on Ubuntu on AWS).
But I am not able to get the cronjob to run properly.
The following is my statement in crontab:
Code: Select all
*/1* * * * * root /opt/bitnami/apps/mantis/htdocs/plugins/EmailReporting/scripts/bug_report_mail.php
This is the result:
Code: Select all
From: root@-removed- (Cron Daemon)
To: root@i-removed-
Subject: Cron <root@-removed-> /opt/bitnami/apps/mantis/htdocs/plugins/EmailReporting/scripts/bug_report_mail.php
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Cron-Env: <SHELL=/bin/sh>
X-Cron-Env: <PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin>
X-Cron-Env: <HOME=/root>
X-Cron-Env: <LOGNAME=root>
Message-Id: <-removed->
Date: Mon, 7 Jan 2019 14:47:01 +0000 (UTC)
/opt/bitnami/apps/mantis/htdocs/plugins/EmailReporting/scripts/bug_report_mail.php: 1: /opt/bitnami/apps/mantis/htdocs/plugins/EmailReporting/scripts/bug_report_mail.php: cannot open ?php: No such file
/opt/bitnami/apps/mantis/htdocs/plugins/EmailReporting/scripts/bug_report_mail.php: 2: /opt/bitnami/apps/mantis/htdocs/plugins/EmailReporting/scripts/bug_report_mail.php: Syntax error: "(" unexpected
Installed postfix and got the logs from /var/mail.
I have checked and from the bug_report_mail.php is in the stated folder. I am able to execute it on command prompt without any problems. Ran out of ideas. Anyone know how to fix this crontab? I've also tried to point to the PHP folder which is found in /opt/bitnami/php/bin.
nolankam
Posts: 9 Joined: 30 Dec 2018, 07:33
Post
by nolankam » 08 Jan 2019, 03:36
I have done so. However, I am getting errors in the permissions.
Code: Select all
From: root@-removed- (Cron Daemon)
To: root@-removed-
Subject: Cron <root@-removed-> /opt/bitnami/php/bin /opt/bitnami/apps/mantis/htdocs/plugins/EmailReporting/scripts/bug_report_mail.php
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Cron-Env: <SHELL=/bin/sh>
X-Cron-Env: <HOME=/root>
X-Cron-Env: <PATH=/usr/bin:/bin>
X-Cron-Env: <LOGNAME=root>
Message-Id: <20190108032201.1B60382AF6-removed->
Date: Tue, 8 Jan 2019 03:22:01 +0000 (UTC)
/bin/sh: 1: /opt/bitnami/php/bin: Permission denied
I made these changes using
sudo crontab -e . Previously, I had also tried to edit the crontab file in /etc but received the same errors. I had also check the permissions for /opt/bitnami/php to make sure it is executable.
cas
Posts: 1622 Joined: 11 Mar 2006, 16:08
Contact:
Post
by cas » 08 Jan 2019, 08:49
What we found in the past that it is best to change to the right directory first like:
cd \Sites\mantis\plugins\EmailReporting\scripts
G:\php\php.exe bug_report_mail.php
Perhaps that can help you
SL-Gundam
Posts: 722 Joined: 06 Jul 2011, 14:17
Post
by SL-Gundam » 08 Jan 2019, 17:48
I've never used bitnami. I suggest you ask bitnami support how to call PHP from cronjob
In my opinion it should work since you are trying to run the job as root. Which should give you all necessary permissions
nolankam
Posts: 9 Joined: 30 Dec 2018, 07:33
Post
by nolankam » 09 Jan 2019, 01:17
Thanks. Issue is closed.
Edited the crontab file in /etc into the following
Code: Select all
*/1* * * * * bitnami /opt/bitnami/php/bin/php/opt/bitnami/apps/mantis/htdocs/plugins/EmailReporting/scripts/bug_report_mail.php
The only change I made was to add the additional php in the path of the php binary. Seems to work now.