1

I just got cron jobs for my website and I am trying to figure out how to make it execute the job every 1 minute, that isnt the problem. my problem is i don't know what I should put for the command to execute. This is what the page looks like in my cpanel

enter image description here

I want it to execute a script from my website which is located here - http://www.mymcstatus.net/scripts/update.php.

What command would I use to do this?

PS: From one of the comments posted I used curl http://www.mymcstatus.net/scripts/update.php works perfectly.

2
  • 3
    Try curl or wget if you just need to hit the URL. Commented Dec 7, 2011 at 3:03
  • So for the command would I just put "wget mymcstatus.net/scripts/update.php" ? Commented Dec 7, 2011 at 3:04

3 Answers 3

2
   (may need path)php (server file path)update.php

that's the minimum

Using PHP from the command line

Sign up to request clarification or add additional context in comments.

Comments

0

From one of the comments posted I used curl http://www.mymcstatus.net/scripts/update.php works perfectly.

1 Comment

this may work, but there is nothing to stop anyone accessing the url, triggering whatever your 'cron' is doing. - you might want to put scripts of this nature outside your root or put a .htaccess file in to a folder to deny all access (this won't stop cron looking at it though). :-)
0

You run a PHP script with cron using the PHP command:

php /path/on/server/to/script.php

That will work, but any file paths inside the script will be relative from the cron directory and not the PHP script directory. So make sure you use absolute paths in the script instead of local paths, or change the script's working directory at the top of the script.

A little cheat is to use wget to load it which will still use the relative paths, but I'm not a fan of that method.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.