Solved

Creating a cron job that will run a php script

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Google Mini is no longer serving everything 7 154
check failing on yum update 5 29
Understanding curl command 1 50
php session folder question (Code Igniter) 3 74
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…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…
This is a video describing the growing solar energy use in Utah. This is a topic that greatly interests me and so I decided to produce a video about it.

911 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

19 Experts available now in Live!

Get 1:1 Help Now