Easy Instructions On Setting Up a Cron Job Required

Can someone let me know how I setup a cron job on a Linux server (Apache) to run the following:


I need it to run every 15 minutes but I am a) a newbie when it comes to cron jobs on Linux and b) need it setup asap. Any questions please fire away!

Who is Participating?
suggestionstickConnect With a Mentor Commented:


use the crontab tool

crontab -u "insert username that you want cron to run under here"  -e (this might be default, what user has perms on cron.php)

add the following line

*/15 * * * * * /home/default/domain-name.com/user/htdocs/crons/cron.php

save and exit

AndoverITAuthor Commented:
Thanks Trev - I'll give it a try and let you know very shortly.
ygouthamConnect With a Mentor Commented:
small correction

crontab -u <username> -e

added line should be

*/15 * * * * /usr/bin/php  /home/default/domain-name.com/user/htdocs/crons/cron.php

it is essential to tell the system to use the php executable to run the php file.  or change the "/usr/bin/php" to wherever the php binary is
Build your data science skills into a career

Are you ready to take your data science career to the next step, or break into data science? With Springboard’s Data Science Career Track, you’ll master data science topics, have personalized career guidance, weekly calls with a data science expert, and a job guarantee.

man cron
man crontab

yes indeed "ygoutham" is spot on, you should specify the full path to the php, just incase it is not in the cron job owners path

try the following command to locate php

which php

AndoverITAuthor Commented:
Thanks for all the tips guys - and sorry about the delay. Have now managed (I think) to get it setup and should have an answer in the morning if it worked.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.