Quote:
Originally Posted by Star Man
do I start to set up cron? Is this a program I download?Is it already included with my TGP script?Do I have to get something from my host? 
|
cron will 99.9% of the time already be running on the web server you're on. Windows/IIS calls it AT if I recall.
To use it, you would input a string of symbols/numbers and the path to the script and what you wanted it to do. If you wanted to have it call a maintenance script every hour at the top of the hour, the entry would look like:
Code:
0 * * * * /usr/bin/wget -O /dev/null http://url.com/maintenance.php 2>&1>/dev/null
of course, that would send any output to the trashbin, so, if there was an error, you wouldn't know about it. Removing -O /dev/null and the 2>&1>/dev/null would have it send email to the account that the cron was created under.
The first field is the minute, the second is the hour -- the rest are usually not used often, but they are day of month, month, day of week.
So, if you wanted something to run every 5 minutes, the first part would be:
*/5 * * * *
To run on the 15s, you can do something like:
*/15 * * * *
or
0,15,30,45 * * * *
As you can see, its pretty flexible and you can do quite a bit with it. Running a task every monday at midnight would look like:
0 0 * * 1
(1 = Monday. 0 & 7 = Sunday)
Some webhosts have a control panel that hides some of the complexity figuring out the numbers -- and there are webpages that allow you to calculate what the resulting line would look like.
crontab generator is but one example.
Getting your cron job installed on the server can sometimes require ssh access, or, your webhost to handle it through the control panel or a trouble ticket.
Some scripts do attempt to create the jobs themselves with some success depending on how the webhost runs their security.