Welcome to Linux Forums!

With a comprehensive Linux Forum, information on various types of Linux software and many Linux Reviews articles, we have all the knowledge you need a click away, or accessible via our knowledgeable members.

Linux Forum ArticlesLinux ForumsLinux Forum DownloadsLinux Hosts
Home|Register|FAQ|Member List|Calendar|Unanswered Posts|Forum Rules|Today's Posts|Advanced Search|
SEARCH FOR IN
Go Back   Linux Forums > GNU Linux Zone > Linux Programming & Scripting
Reload this Page setting up cron to run php files
Linux Forums
Linux Forums
Welcome To The Linux Forums!
Welcome to Linux Forums. We pride ourselves in being one of the largest Linux communities on the web, we encourage you to REGISTER on our forums and participate in the community. There are over 150,000 members ready to answer your questions. JOINING US today will allow you to make new posts, get support, send messages to other members and submit downloads to our downloads directory and many other great features!

Linux Programming & Scripting C, Perl, PHP, Bash Scripts, anything programming or script related post in here!

Reply
 
Thread Tools Display Modes
Old 06-20-2008   #1 (permalink)
mmarif4u
Just Joined!
 
Join Date: Jun 2008
Posts: 2
setting up cron to run php files

Hi to all.
I want to run a php file through crontab.
I know some basic things about cron.but need some more details.
I have a dedicated server for one of my client running Debian on it.
I want to run a php script where it will update some database tables in a 10 or 5 min interval of time. the best bet here is to run that script through crontab.
i know it will be something like this:
Quote:
10 * * * * /usr/local/bin/php /var/www/html/cron.php
but now how could i setup this cron file to run properly.
And is the above command is right and will work.
how to run cron under a normal user,mean to create a file like cron.allow OR cron.deny

Any details will be appreciated.

Thanks
mmarif4u is offline   Reply With Quote
Old 06-20-2008   #2 (permalink)
vsemaska
Linux Newbie
 
Join Date: Jun 2007
Posts: 207
The cron file is the crontab. You edit the file with the command:

Code:
crontab -e
It'll put you in your default editor. The command you gave:

Quote:
10 * * * * /usr/local/bin/php /var/www/html/cron.php
is wrong. It'll run at 10 minutes after the top of each hour (ex 2:10, 3:10, 4:10, etc). What you want is:

Quote:
0-59/10 * * * * /usr/local/bin/php /var/www/html/cron.php
This says to run at minute 0 and step in 10 minute intervals. Look at the manpage for crontab for details:

Quote:
man 5 crontab
You shouldn't have to do anything with cron.allow or cron.deny. I believe the default is to allow all users to set up crontabs.
vsemaska is offline   Reply With Quote
Old 06-21-2008   #3 (permalink)
mmarif4u
Just Joined!
 
Join Date: Jun 2008
Posts: 2
Thanks vsemaska.
I was aware of that to setup mins.
Also i think we can put like */10.It will run after 10 min every hour.
i will try your solution as you mention.
I tried it also from some sources of google.but i think the problem was coming from PHP execution directory.
I am going to try on other linux distro.
Hope it will work.

Thanks buddy for your time.
mmarif4u is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




All times are GMT. The time now is 12:52 PM.




© 2000 - 2008 - All Rights Reserved - Property of  MAS Media

Content Relevant URLs by vBSEO 3.0.0