View Full Version : autocron doesn't work
pentabase
01-25-2008, 08:09 AM
Hi all,
I've installed osticket and it's working perfectly. except the auto fetch email option doesn't work. I've been searching this forum but can't find the correct solution for my problem.
What happens is this:
i've setup the auto fetch email with a cronjob. I can see in the syslog that the command line is processed from the cronjob
/USR/SBIN/CRON[11327]: (root) CMD (/usr/bin/php /var/www/vhosts/xxxx/httpdocs/api/cron.php)
But then i don't recieve an email.
on the other hand, when i manually enter the cronjob commandline as root, it does the job and i recieve the confirmation email.
What could be the problem?
with regards,
Henk Bakker
bigben
01-26-2008, 10:23 PM
I too am having the same problem. I have tried setting the script to run as apache, nobody, and even root with the same effect from the crontab. For that matter I can not even find any entry in any log file showing an error.
Any advice would be greatly appreciated.
Thank you,
Ben
bigben
01-27-2008, 09:15 AM
I got it working. Even though PHP is complied as an API and not CGI I changed the command from:
*/5 * * * * nobody /path/to/php /path/to/api/cron.php
to
*/5 * * * * nobody /path/to/php-cgi /path/to/api/cron.php > /dev/null 2>&1
And not it is working like a charm. I added the > /dev/null 2>&1 so that it does not send me an e-mail each time the script runs. It will just dump all output to /dev/null.
I hope this works for you also.
Take care,
Ben
pentabase
01-28-2008, 07:02 AM
hi Ben,
i've tried your settings, but unfortunately it didn't work. what could be the difference between running the commandline manual and by cron?
regards,
Henk
bigben
01-28-2008, 07:12 AM
Their should not be any difference. If you remove the > /dev/null 2>&1 when it runs it should send an e-mail with any errors to who ever you are running the script as. If you are using a shared account, perhaps try changing the person it runs as to your user name and see if that will send you any error codes it is running. Ie:
*/5 * * * * yourusername /path/to/php-cgi /path/to/api/cron.php
Or
*/5 * * * * yourusername /path/to/php /path/to/api/cron.php
renato.pinheiro
02-20-2008, 10:56 AM
I tried this way, but I always receive this message:
Status: 403 Forbidden
X-Powered-By: PHP/5.2.4
Set-Cookie: PHPSESSID=tdesp2eobtnvg6pm8ldm7pnsv7; path=/
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Status: 403 Forbidden
Connection: Close
Content-Type: text/plain; charset=UTF-8
Content-Length: 2
77
if I execute the command through it console (ssh), seemingly everything works.
Can anybody help me?
renato.pinheiro
02-20-2008, 01:32 PM
I tested again and, in the command line, everything works, but when I use the crontab receive the message of the previous post
saaiber
02-20-2008, 03:47 PM
Can you try to set your cronjob without username? In my config I didn't have to enter root or username.
Grtz,
Nic
renato.pinheiro
02-20-2008, 04:09 PM
The error was not in the osTicket.
I use the webmin (http://www.webmin.com/ - a web administration system) to manage my server and I were testing the cronjob through the webmin, with the option run now. But, why I don't know, the IP address used when I use the run now is the address of the computer where I am accessing the webmim and not address of the server, for that the access was denied.
Looking at the log of when the cronjob turns automatically, I see that everything work.
X-Powered-By: PHP/5.2.4
Set-Cookie: PHPSESSID=1vbpt1l0s82aud4gd5elv7rj82; path=/
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Content-type: text/html