• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 256
  • Last Modified:

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:

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

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!

Thanks
0
AndoverIT
Asked:
AndoverIT
2 Solutions
 
suggestionstickCommented:
Hi

use

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


Trev
0
 
AndoverITAuthor Commented:
Thanks Trev - I'll give it a try and let you know very shortly.
0
 
ygouthamCommented:
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
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
ozoCommented:
man cron
man crontab
0
 
suggestionstickCommented:
Hi


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


Trev
0
 
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.

Thanks
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now