We build. You grow.

Get best community software here

Start a social network, a fan-site, an education project with oxwall - free opensource community software

cron job and htaccess | Forum

Topic location: Forum home » Support » General Questions
GH
GH Oct 19 '11
Hi,
Ive been fighting with the isp, as to why my cron jobs wound run. They wrote me back and told me that my htaccess is not allowing cron jobs, and renamed the file .. but now, my site wont work right.. the Login wont redirect etc.. ARGG!

Can you see something in my htaccess that would limit cron jobs in OW?

Here the code..



Options +FollowSymLinks
RewriteEngine On

RewriteCond %{REQUEST_URI} .*/http-bind
RewriteRule (.*) /http-bind [L]

RewriteCond %{REQUEST_URI} !^/index.php
RewriteCond %{REQUEST_URI} !/ow_updates/index.php
RewriteCond %{REQUEST_URI} !/ow_updates/
RewriteCond %{REQUEST_URI} (/|\.php|\.html|\.htm|\.feed|\.raw|/[^.]*)$  [NC]

RewriteRule (.*) index.php

Keelan Leader
Keelan Oct 19 '11
Seems fine to me, whats your cron look like?

mine:


Options +FollowSymLinks
RewriteEngine On

RewriteCond %{REQUEST_URI} .*/http-bind
RewriteRule (.*) /http-bind [L]

RewriteCond %{REQUEST_URI} !^/index.php
RewriteCond %{REQUEST_URI} !/ow_updates/index.php
RewriteCond %{REQUEST_URI} !/ow_updates/
RewriteCond %{REQUEST_URI} (/|\.php|\.html|\.htm|\.feed|\.raw|/[^.]*)$  [NC]

RewriteRule (.*) index.php

The Forum post is edited by Keelan Oct 19 '11
GH
GH Oct 19 '11
Weird.. The cron worked fine for a while..Then stopped.. I can run it from shell with no errors..

Tech support said that they removed the htaccess, it worked.. told me that something in my code was blocking cron. but ow needs it to run..

Ive written tech support back, asking them what in the code they think might be blocking it..

Keelan Leader
Keelan Oct 19 '11
Strange, if it worked and you didnt change anything then a host issue id say? Does your cron allow 1 min intervals?
GH
GH Oct 19 '11
It did allow 1 minute , even though they told me it woudnt.. I was real excited.. worked for a while, then stopped.. Now, doesnt even work with 5 min

GH
GH Oct 19 '11
Now its working.. I have no idea what changed.. Its so weird..

Matthias Jäger
Matthias Jäger Oct 22 '11
There's cron, and then there's cron...

Oxwalls cron job is implemented as a php-script, it can be run by the server itself (using the local php-interpreter, usually /usr/local/bin/php or similar) or called from outside through the web-server, e.g. typing "http://www.yoursite.net/ow_cron/run.php" in your adress bar. But the rewrite rules in .htaccess deny access to this script, they rewrite the url to add index.php. In order to run cron-script from outside you have to exclude "ow_cron/run.php" from the rewrite conditions, to do so you can add

RewriteCond %{REQUEST_URI} !/ow_cron/run.php

(this means: rewrite only if the request is not to /ow_cron/run.php)

e.g. my .htaccess files is as follows:
--- quote ---
Options +FollowSymLinks
RewriteEngine On
RewriteBase /

RewriteCond %{REQUEST_URI} .*/http-bind
RewriteRule (.*) /http-bind [L]

RewriteCond %{REQUEST_URI} !^/index.php
RewriteCond %{REQUEST_URI} !/ow_updates/index.php
RewriteCond %{REQUEST_URI} !/ow_updates/
RewriteCond %{REQUEST_URI} !/ow_cron/run.php
RewriteCond %{REQUEST_URI} (/|\.php|\.html|\.htm|\.feed|\.raw|/[^.]*)$  [NC]

RewriteRule (.*) index.php
GH
GH Oct 22 '11
Im still waiting for the response from the provider..

The bottom line is, that the Server isnt even firing the cron job at all.
They have yet to tell me why.. Driving me crazy

Matthias Jäger
Matthias Jäger Oct 22 '11
Meanwhile you could still trigger the ow_cron/run.php script from an external cron-service. Usually you can get a "trigger every 5 minutes" service for free; that's not the same as running cron locally, but it'll get you started with your site. for external cron-jobs you must add the aforementioned line to your .htaccess file.
Pedro
Pedro Oct 30 '11
this only for cpanel cron job

php /home/yourpanel/public_html/ow_cron/run.php

your .
htaccess should not have anything to do with the cron job
The Forum post is edited by Pedro Oct 30 '11
Keelan Leader
Keelan Oct 31 '11
Quote from Pedro this only for cpanel cron job

php /home/yourpanel/public_html/ow_cron/run.php

your .
htaccess should not have anything to do with the cron job

cpanel is:

/usr/bin/php -q /path/to/oxwall/ow_cron/run.php
Matthias Jäger
Matthias Jäger Oct 31 '11
.htaccess won't interfere with your local cron jobs, true. But if you want to run the cron jobs from outside - e.g. for testing the script - you need to modify .htaccess as stated. .htaccess could only interfere if you configured your cron-job wrong, like using the scripts URL instead of its filepath. what exactly did you put in your cron-job definition?
kalvindarwan
kalvindarwan Dec 22 '23
Through the use of loading ramps, straps, and chocks, we’ll get your bike where it needs to go, safe and sound. San Jose Driveway Company
James Walter
James Walter Jan 2
This includes inspections, lubrication, and any other services necessary to ensure your trailer is running smoothly. Vacaville Concrete Solutions