Solved

Creating a cron job that will run a php script

Posted on 2004-10-20
1
378 Views
Last Modified: 2010-04-21
Hi :)

I know how to do the whole time setup * * * * * thing, and cronjobs are already enabled on my server. (I already have some that backup my DBs automatically every night).

But!  Let's say I wanted to run /home/user/public/script.php in a cronjob. Assuming I wanted the time to be * * * * * ... what would my exact command line be? I'd like to NOT use a .sh file if possible, as I'm not familiar with those. Thanks :)
0
Comment
Question by:runelynx
1 Comment
 
LVL 38

Accepted Solution

by:
yuzh earned 350 total points
ID: 12355943
1) make sure that you have

#!/path-to/php

as the FIRST line of your /home/user/public/script.php

and then make the crontab looks like:

* * * * * /home/user/public/script.php  >/dev/null 2>&1

please do the followings to modify the crontab:
EDITOR=vi
export EDITOR
crontab -e

put your cron record in and save it.
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
qos on linux 3 101
benchmark write speed to disk on linux 2 67
check failing on yum update 5 30
Error while installing rpm 1 83
Have you ever been frustrated by having to click seven times in order to retrieve a small bit of information from the web, always the same seven clicks, scrolling down and down until you reach your target? When you know the benefits of the command l…
The purpose of this article is to fix the unknown display problem in Linux Mint operating system. After installing the OS if you see Display monitor is not recognized then we can install "MESA" utilities to fix this problem or we can install additio…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question