Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
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!

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.php2) 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.

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?

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

![]() |
![]() |
![]() |

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