Just installed OSTicket 1.7 to replace the good old 1.6

I had on a little server at home a cron-job running to activate the mailfetch on my webserver elsewhere in the country.

wget -q -0 /dev/null --user-agent= http://myhost.com/support/api/cron.php(http://myhost.com/support/api/cron.php)

This worked like a charme however in 1.7 there has been a change. Searched this forum but did not find a correct awnser.

i tried calling rcron.php but this resolved into a error 400.

i tried calling api/cron.php this resuled in a URL not supported

tried calling api/task/cron also resuling in a URL not supported.

What is for 1.7 the best way to trigger the mailfetch from a remote location using a cronjob on a home server?

Try...

wget -q -0 /dev/null --header='X-API-Key: <API-KEY-HERE>' http://myhost.com/support/api/tasks/cron

Follow the steps below when using rcron.php

1. Upload rcron.php to a directory or your choice - I recommend creating unique/ramdom name somewhere on the web server path or simply rename rcron.php to a name of your choice.

2. Edit rcron.php to add API key and change the url.

The url should be http://myhost.com/support/api/tasks/cron(http://myhost.com/support/api/tasks/cron).

Note lack of .php extension and tasks not task (as of RC6)

3. In your host panel - create a cron entry to point to rcron.php (based on where you put it in step #1) or use crontab entry below.

wget -q -0 /dev/null http://myhost.com/support/api/tasks/cron

If i do the wget --header='X-API-Key: ' http://myhost.com/support/api/tasks/cron(http://myhost.com/support/api/tasks/cron)

without the -q -0 /dev/null i acually see what is done. This is what i get.

Resolving mydomain.nl (mydomain.nl)... XXX.XXX.XXX.XXX (i masked the IP Adress)

Connecting to mydomain.nl (mydomain.nl)|XXX.XXX.XXX.1XXX... connected.

HTTP request sent, awaiting response... 400 Bad Request

2013-04-04 22 ERROR 400: Bad Request.

just tried : The call to the rcron.php also results into a error 400

Do you have modrewrite disabled?

Try http://myhost.com/support/api/http.php/tasks/cron(http://myhost.com/support/api/http.php/tasks/cron) - if that fails too then go the rcron.php route.

I think I got it - it has to be a post request.

wget --post-data '' --header='X-API-Key: <API-KEY-HERE>' http://myhost.com/support/api/tasks/cron

same problem.. tried everything here... no go

Hosted on iis7

I think I got it - it has to be a post request.

wget --post-data '' --header='X-API-Key: <API-KEY-HERE>' http://myhost.com/support/api/tasks/cron

now i get a competed back .. Nice ! Thanks!

Tested with a testmail and the mail is picked up

Now i'm trying to get the rcron.php to work. I followed the previous steps

When i call rcron.php from the browser i get also an error 400.

HTTP/1.1 400 Bad Request Date: Fri, 05 Apr 2013 05 GMT Server: Apache/2 X-Powered-By: PHP/5.3.22 Set-Cookie: PHPSESSID=3634a3bd154c506cb85b5ca7c4d103de; path=/ Expires: Thu, 19 Nov 1981 08 GMT Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 Pragma: no-cache Status: 400 Bad Request Connection: Close Content-Length: 17 Vary: Accept-Encoding,User-Agent Content-Type: text/html; charset=UTF-8 URL not supported

I solved it by using an aspx script to run it locally at the server with a page request but I am not sure if I'm allowed to post aspx code here?

Now i'm trying to get the rcron.php to work. I followed the previous steps

When i call rcron.php from the browser i get also an error 400.

HTTP/1.1 400 Bad Request Date: Fri, 05 Apr 2013 05 GMT Server: Apache/2 X-Powered-By: PHP/5.3.22 Set-Cookie: PHPSESSID=3634a3bd154c506cb85b5ca7c4d103de; path=/ Expires: Thu, 19 Nov 1981 08 GMT Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 Pragma: no-cache Status: 400 Bad Request Connection: Close Content-Length: 17 Vary: Accept-Encoding,User-Agent Content-Type: text/html; charset=UTF-8 URL not supported

Calling rcron.php is not needed anymore. The cronjob is running fine now.

@[deleted] : Thanks for this solution :)

20 days later

I think I got it - it has to be a post request.

wget --post-data '' --header='X-API-Key: <API-KEY-HERE>' http://myhost.com/support/api/tasks/cron

This was EXACTLY what I needed for my problem, too!

I was banging my head against the wall for HOURS over this one last night. I guess I was too tired to put the right search terms in.

Thanks.

--Noam

5 months later

Thanks Peter

for the --post-data

In my case that bit was needed since my hoster wants extra cash for cron calls.

Posting the api key and calling the configured rcron.php did the Job for me.

Thanks!

gk-edv

Write a Reply...