FRIHOSTFORUMSSEARCHFAQTOSBLOGSCOMPETITIONS
You are invited to Log in or Register a free Frihost Account!


cron jobs





mikelll
How to create a cron job in direct admin that opens an url of a website?

thanks
mikelll
need help here!!!
Bondings
You should be able to execute a php (or other) script of yourself with a cron job. I'm not sure it if's possible to execute a page not on your website, at least not directly.
mikelll
Bondings wrote:
You should be able to execute a php (or other) script of yourself with a cron job. I'm not sure it if's possible to execute a page not on your website, at least not directly.

Its a page on my frihost website!! I don't know how to set up cron... Confused
Bondings
mikelll wrote:
Bondings wrote:
You should be able to execute a php (or other) script of yourself with a cron job. I'm not sure it if's possible to execute a page not on your website, at least not directly.

Its a page on my frihost website!! I don't know how to set up cron... Confused

The actual command is:
Code:
/usr/local/bin/php -q /home/<username>/domains/<domain>/public_html/page.php >/dev/null 2>&1

The last part make sure that the output is discarded and not emailed to you.

You should replace <domain> with your subdomain/domain name and <username> with your DirectAdmin username. And then change page.php to the php page you want to execute. And possibly add a directory.

You should add the cronjob in DirectAdmin and please note that it isn't allowed to be set more often than once every 15 minutes and shouldn't be a very heavy script. (otherwise it can be removed)
mikelll
Bondings wrote:

The actual command is:
Code:
/usr/local/bin/php -q /home/<username>/domains/<domain>/public_html/page.php >/dev/null 2>&1


Are you kind enough to see in my directadmin if it is like I had just did?
I want to run it one time per hour...
Bondings
The cronjob seems fine and should execute every 30 minutes. However, I suppose the cron job has a specific task to do, so to be completely sure it works fine, check if it did what it was supposed to do (a few minutes after x:30 hour).
mikelll
ok, thanks very much
mikelll
not working...
Nothing had happend since then and if I run the url manualy it works...
Are you shure of the sintaxe? Is the ">" after the php word wright?
Bondings
I would suggest to remove the part behind the actual url then. It will probably send you an email with the output and/or error.
mikelll
Bondings wrote:
I would suggest to remove the part behind the actual url then. It will probably send you an email with the output and/or error.

I dont think I understand...can you do it in my directadmin? add another cron, please!
Bondings
mikelll wrote:
Bondings wrote:
I would suggest to remove the part behind the actual url then. It will probably send you an email with the output and/or error.

I dont think I understand...can you do it in my directadmin? add another cron, please!

I added a version without the /dev/null part, executed at the same time.

I also tried to execute the page and it returned nothing after running for a while. Is this normal?
mikelll
yes it is normal!
it runs a script that loads feeds into my site. I see that I have new feeds, because you had opened the url.
Lets wait then to see if the new cron works. I let you know! thanks for the help
Bondings
It seems like this way the get parameters are not passed to the page. The best way is to create a page (without any parameters needed) that does the same job.

Otherwise you could try:
Code:
/usr/bin/w_get 'http://yourwebsite/yourpage.php?variables '

But I'm not sure if w_get will work. Also please remove the _ from w_get. Mod_security seems to block it so I'm not able to post it here without putting something in between.
mikelll
mikelll wrote:
yes it is normal!
it runs a script that loads feeds into my site. I see that I have new feeds, because you had opened the url.
Lets wait then to see if the new cron works. I let you know! thanks for the help

doesn't worked...

I will try with your new sugestion.
The page that it is suposed to open doesn´t display any data. It is suposed to be like that! It activates a component of the joomla that uploads external feeds to my site.
Bondings
Yeah, but using php in command line like this doesn't allow any get parameters. Hence that's the reason it doesn't work. So if you are able to create a page (without parameters needed) that does the same thing (or that executes that url), then it should work.
mikelll
tryed other ways and still not working...

You sugestion is interesting, but...How can I do it? Build a page with thal url on it? I dont't understand how can I do it Sad
Bondings
mikelll wrote:
tryed other ways and still not working...

You sugestion is interesting, but...How can I do it? Build a page with thal url on it? I dont't understand how can I do it Sad

Create a new page called cronjob.php (or similar). And copy the contents of the file you want to execute in it. However, after the start of the start of php add the parameters; something like that:
Code:
$_GET['parameter']='value';
mikelll
Bondings wrote:
mikelll wrote:
tryed other ways and still not working...

You sugestion is interesting, but...How can I do it? Build a page with thal url on it? I dont't understand how can I do it Sad

Create a new page called cronjob.php (or similar). And copy the contents of the file you want to execute in it. However, after the start of the start of php add the parameters; something like that:
Code:
$_GET['parameter']='value';

I don't have a "page.php"...
I only have one URL that triggers some code on a module! It displays a blank page whith no php code in it!
The problem is in some configuration of frihost crontab.
But don't waste more time on it...I think I have a solution! I discover a site that does the job! it refreshes an url for the time interval you want. all I need is an open browser.

http://www.pagereboot.com/ie/
Bondings
I have create a cronjob.php file with the trick I mentioned above. Please check if it works fine. If yes, you can use it as a cronjob.
mikelll
is the file in my domain files? I can't see it there...
It didn't activate my joomla module, I have no new feeds
mikelll
mikelll wrote:
is the file in my domain files? I can't see it there...
It didn't activate my joomla module, I have no new feeds

wait...it was on the wrong domain...I will set the cron job now for the .frihost domain and see if it works
Bondings
I think I used the wrong domain, sorry. But it seems like you already copied it to the right one. Please inform me if it works fine or not. Very Happy
mikelll
Bondings wrote:
I think I used the wrong domain, sorry. But it seems like you already copied it to the right one. Please inform me if it works fine or not. Very Happy

sorry...not working Crying or Very sad
see please if I did configure cron well
mikelll
the messages I receive by mail from cron:

/bin/sh: /usr/bin/w_get: No such file or directory

are you shure is this w_get exists?

and other example:

/usr/local/bin/php -q /home/mikelll/domains/pt-tech.frihost.org/public_html/cronjob.php

this cronjob emailed me an entire page....
Bondings
It's w_get without the _. I put it there since it won't let me post it on this forum without _.
mikelll
Bondings wrote:
It's w_get without the _. I put it there since it won't let me post it on this forum without _.
Ahh! I didn't know that! Ok lets prey it works now...
Related topics
Cron Jobs
à propos des cron jobs
[RESOLVED] cron jobs
Cron jobs
I don't have cron jobs enabled ?
cron jobs
Cron Jobs
Cron Jobs
Cron Jobs
Cron jobs - running a php file
Executing automated tasks without using cron jobs
cron jobs?
Problems With Cron Jobs
Enabling Cron Jobs
how do I auto backup using cron jobs
Reply to topic    Frihost Forum Index -> Support and Web Hosting -> Web Hosting Support

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.