Computing.Net > Forums > Programming > Questions about cron and php script

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Questions about cron and php script

Reply to Message Icon

Name: colin72
Date: March 23, 2008 at 07:24:37 Pacific
OS: Win XP
CPU/Ram: Pent 4/1 GB
Product: Dell Dimension 4700
Comment:

I'm trying to set up a php script that runs via crontab on a Linux server. I've never done anything like this before. If you can offer any help, please provide as much detail as you can. Thank you for taking the time to read this...


My questions:

1) I want the crontab to run the script everyday from 3:58 PM to 4:13 PM EST. How is that written in crontab?

2) The command I want crontab to run is: php -q /path/to/script.php
According to that path name, where do I put the php script on my server? Do I have to create a folder named "path" with a folder named "to" in it, and put "script.php" in that folder?


Thanks!

More about question #1...

I can access my server through Cpanel (Hostgator). In Cpanel they provide two ways to enter a crontab. Here are screenshots showing both of those Cron Managers:
http://www.iov.in/cpanelcronmanager...


Because I want crontab to run the php script from 3:58 pm EST until 4:13 pm EST, I'm wondering how I am going to be able to enter that into either Cron Managers that Hostgator provides. There doesn't seem to be a way to enter a crontab so it starts 2 minutes before one hour (3 pm) and runs until 13 minutes after the next hour (4 pm).

Once someone does help me with the way the cronjob needs to be written, any ideas on how I enter that code into either one of the Cpanel Cron Managers? If I have to upload the crontab code to the server without using CPanel, how do I do that?


Thanks!



Sponsored Link
Ads by Google

Response Number 1
Name: Razor2.3
Date: March 24, 2008 at 19:41:14 Pacific
Reply:

I don't think cron will let you specify when a job will end; only when it'll start.

1)

58 15 * * * <Your User> php -q /path/to/script.php

2) You modify the /path/to to the real path. Otherwise, you'd have to make a directory called path in the root, then add a directory to to path.


0

Response Number 2
Name: colin72
Date: March 25, 2008 at 19:46:12 Pacific
Reply:

Hi Razor

So basically for "php -q /path/to/script.php" I can change it to "php -q /script.php" and then put the script.php file in the root?


0

Response Number 3
Name: Razor2.3
Date: March 25, 2008 at 20:40:17 Pacific
Reply:

Sure. You probably shouldn't have scripts lying around in root, but I don't think anything prevents it.


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Questions about cron and php script

PhP and ACTION script www.computing.net/answers/programming/php-and-action-script/9181.html

HTML Form/Button : PHP script www.computing.net/answers/programming/html-formbutton-php-script/12159.html

PHP Script and HTML Forms www.computing.net/answers/programming/php-script-and-html-forms/7635.html