Welcome Guest, Not a member yet? Register   Sign In
cron job problems
#1

[eluser]emperius[/eluser]
i need to make cronjob on free bsd

I have a controller name called cron and it has function called index.

what path should i write in the crontab file?

something like this /home/www/system/controllers/cron.php
#2

[eluser]ELRafael[/eluser]
no.

only the php file will not work. The controller extends the class Controller, but will not found, you don't include that inside the file, right?

in this case, is better to put a simple php script. i believe that you'll not do visual things with this.

To me, i only use php in cron jobs when i need to update tables, remove files, somethings like that.
#3

[eluser]emperius[/eluser]
yes I also thought like this but I thought that exists other way
#4

[eluser]emperius[/eluser]
I'm using some hepers in my cron job and that is the reason why I want to call my script this way...
#5

[eluser]ELRafael[/eluser]
i don't know if you can exec by lynx

like lynx http://domain
there is some parameters that accept all cookies and others (don't remmember now).
than you can killall lynx.

but as i said, i don't know if you have internet access in the cron machine.
#6

[eluser]emperius[/eluser]
[quote author="ELRafael" date="1195071108"]i don't know if you can exec by lynx

like lynx http://domain
there is some parameters that accept all cookies and others (don't remmember now).
than you can killall lynx.

but as i said, i don't know if you have internet access in the cron machine.[/quote]

thank you I will try this and tell if something will work Smile
#7

[eluser]thunder uk[/eluser]
If your server has wget on it, you could set up a crontab entry that calls:

wget http://www.mydomain.com/cron/

which would execute your cron controller as expected (ie in a browser-type environment rather than command line script)

Having said that, I agree with the above comment about putting a simple php script together to run from the crontab - using CI to execute a scheduled task would, in most cases I believe, be overkill.

On the other hand, using a "cron" controller in CI could serve additional purposes. You could, for instance, run the cron'd process out-of-schedule by using an img src="/cron/" or via an ajax style request should you ever need to (and assuming your setup doesn't allow for using exec() or backticks etc).

Depends on what you want to accomplish really. Smile
#8

[eluser]emperius[/eluser]
lynx didn't worked....

i'll try also wget
#9

[eluser]emperius[/eluser]
wget also doesnt works it searches for index.html file
#10

[eluser]thunder uk[/eluser]
That's very strange - both lynx (use the -dump option to avoid leaving it running) or wget should simply make an http GET for the relevant file, which your CodeIgniter install should see like any other web browser.

Try either of these??

lynx -dump http://www.mysite.com/index.php/cron/index

OR

wget http://www.mysite.com/index.php/cron/index

(with the index.php in the url)




Theme © iAndrew 2016 - Forum software by © MyBB