Solved

Creating a cron job that will run a php script

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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

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 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…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

758 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now