I have a website in which I need to update the database once every hour. I only have an obscure idea of how. Can someone point me to a tutorial or something? I'm not very good with Unix. I just need to run once script every hour.
Thanks.
Working with Cron?
Moderator: General Moderators
-
Caped Knight
- Forum Commoner
- Posts: 33
- Joined: Wed Jan 01, 2003 6:20 pm
- Location: Somewhere...out there...
Add this to your crontab:
EDIT: Too many stars 
Code: Select all
01 * * * * /path/to/php /path/to/a/php/file/which/updates/your/database.php
Last edited by qartis on Wed Aug 13, 2003 3:06 am, edited 1 time in total.
-
Caped Knight
- Forum Commoner
- Posts: 33
- Joined: Wed Jan 01, 2003 6:20 pm
- Location: Somewhere...out there...
-
Caped Knight
- Forum Commoner
- Posts: 33
- Joined: Wed Jan 01, 2003 6:20 pm
- Location: Somewhere...out there...
Oh, and the meanings? Well, a crontab uses a simple structure. The 01 * * * * represents this:
A minute, expressed as a number from 0 through 59.
An hour, expressed as a number from 0 through 23.
A day of the month, expressed as a number from 1 through 31.
A month of the year, expressed as a number from 1 through 12.
A day of the week, expressed as a number from 0 through 6 (with 0 standing for Sunday).
And an asterisk means every one. So, 01 * * * * means "every month, every day of the week, every hour, one minute out of the hour (the first one).
To get a cron job to run at 3:30 PM every day, you would use 30 15 * * *.
Argument number six is the command to run, and everything after it (including spaces) is included in the command.
My first snippet (condensed) would run `/path/to/php /path/to/file/php` as if it were typed at a prompt.
A minute, expressed as a number from 0 through 59.
An hour, expressed as a number from 0 through 23.
A day of the month, expressed as a number from 1 through 31.
A month of the year, expressed as a number from 1 through 12.
A day of the week, expressed as a number from 0 through 6 (with 0 standing for Sunday).
And an asterisk means every one. So, 01 * * * * means "every month, every day of the week, every hour, one minute out of the hour (the first one).
To get a cron job to run at 3:30 PM every day, you would use 30 15 * * *.
Argument number six is the command to run, and everything after it (including spaces) is included in the command.
My first snippet (condensed) would run `/path/to/php /path/to/file/php` as if it were typed at a prompt.