CRONTAB Help

Connect with other users about what to run on your webhosting (and how to run it) here.
Post Reply
Kilroy85
New to forums
New to forums
Posts: 3
https://www.youtube.com/channel/UC40BgXanDqOYoVCYFDSTfHA
Joined: Wed May 18, 2016 6:55 pm

CRONTAB Help

Post by Kilroy85 »

Trying to figure out how to run a php crontab.

Right now I am attempting to execute it every minute so that I can test to make sure I have the correct path, yet I am not getting an email telling me anything and it doesn't seem to be executing the script I want to run.

This is what I have in the webserver nfo control panel crontab:

MAILTO="myemailaddress"

1 * * * * php /home/[nfo username]/private/[what script I want to run.php]

I am sure I am jacking up the file path, but I am unsure how to test/fix it.
It'sRandinator
This is my homepage
This is my homepage
Posts: 97
Joined: Wed Dec 02, 2015 10:56 pm

Re: CRONTAB Help

Post by It'sRandinator »

The path of the php binary has to be added.

1 * * * * /usr/bin/php /home/[nfo username]/private/[what script I want to run.php]

Make sure the crontab file ends with an empty line.
User avatar
Edge100x
Founder
Founder
Posts: 12948
Joined: Thu Apr 18, 2002 11:04 pm
Location: Seattle
Contact:

Re: CRONTAB Help

Post by Edge100x »

If you want it to run every minute, you have to put * for the minutes field. If you put a 1, it will only run at minute 1 of each hour (an hour starts at minute 0 and goes through minute 59).

* * * * * yourcommand

You should also use the full path to the php executable, as It'sRandinator suggested.
Kilroy85
New to forums
New to forums
Posts: 3
Joined: Wed May 18, 2016 6:55 pm

Re: CRONTAB Help

Post by Kilroy85 »

is the file path of /home/[nfo username]/private/[executable.php] correct?

Just trying to make sure it will be able to find the php file.

It is telling me:
Could not open input file:
Kilroy85
New to forums
New to forums
Posts: 3
Joined: Wed May 18, 2016 6:55 pm

Re: CRONTAB Help

Post by Kilroy85 »

Disregard all, figured it out! Sorry never used putty before but that helped me figure out the file path.

Thank you both for all the help! :D
User avatar
Edge100x
Founder
Founder
Posts: 12948
Joined: Thu Apr 18, 2002 11:04 pm
Location: Seattle
Contact:

Re: CRONTAB Help

Post by Edge100x »

I'm sorry, I should have noticed that -- the path should normally start with /usr/www/yourusername.
Post Reply