good_evening
good_evening

Reputation: 21729

Cronjob every minute

I have a file in mysite.com/url1/url2/cronjob.php which has to be run every minute. I try every combination, but can't succeed. What should I run in command line? Thank you.

Upvotes: 20

Views: 30660

Answers (5)

стривігор
стривігор

Reputation: 126

The PHP interpreter.

/[path-to-php]/php -f [your-php-script]

Upvotes: 2

madhu131313
madhu131313

Reputation: 7386

I got confused for the first time where to add all of these and finally found.

Type the following in the linux/ubuntu terminal

 crontab -e 

select an editor (sometime it asks for the editor) and this to run for every minute

*       *       *       *       *       /usr/bin/php path/to/cron.php &> /dev/null

Upvotes: 2

AllanNorgaard
AllanNorgaard

Reputation: 284

Are you looking for help to make an UNIX cronjob?

If so, have you tried to edit /etc/crontab, and add

\1 * * * * user command

where user is either root or your name. Im not exactly sure how to access and URL, but a dirty way could involve downloading the link as a file, e.g. "wget http://url.com/page.php"

Upvotes: 0

Ish
Ish

Reputation: 29536

Steps your shell

$ crontab -e


* * * * * php -f /path/to/cron.php
~
~

Upvotes: 2

Linus Kleen
Linus Kleen

Reputation: 34612

In case you'd set it up in a crontab, this works:

*/1 * * * * /usr/bin/wget -O /dev/null http://example.com/cron.php

Upvotes: 40

Related Questions