Solved

Creating a cron job that will run a php script

Posted on 2004-10-20
1
379 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

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…
The purpose of this article is to demonstrate how we can upgrade Python from version 2.7.6 to Python 2.7.10 on the Linux Mint operating system. I am using an Oracle Virtual Box where I have installed Linux Mint operating system version 17.2. Once yo…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

830 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