Greenguy's Board


Go Back   Greenguy's Board > Programming & Scripting
Register FAQ Calendar Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Search this Thread Rate Thread Display Modes
Old 2008-08-14, 10:36 PM   #1
Star Man
A boy without mischief is like a bowling ball without a liquid center
 
Star Man's Avatar
 
Join Date: Feb 2006
Location: clevel.......don't make me say it!
Posts: 436
So if I have a specific cron set on my server to update at midnight would I have to bug my host again if I suddenly wanted to change the settings?
__________________
good luck
Star Man is offline   Reply With Quote
Old 2008-08-14, 11:00 PM   #2
cd34
a.k.a. Sparky
 
cd34's Avatar
 
Join Date: Sep 2004
Location: West Palm Beach, FL, USA
Posts: 2,396
Quote:
Originally Posted by Star Man View Post
So if I have a specific cron set on my server to update at midnight would I have to bug my host again if I suddenly wanted to change the settings?
sometimes. Most of the time cron is in a control panel and can be somewhat easily modified. I think virgohippy has a regular cron call a 'wrapper' that he has decide what needs to be executed -- so that way, his cron entry never changes and he can just modify his script to do whatever actions he requires.

Generally though, cron isn't as difficult as a lot of people make it out to be.
__________________
SnapReplay.com a different way to share photos - iPhone & Android
cd34 is offline   Reply With Quote
Old 2008-08-15, 12:04 AM   #3
virgohippy
Madness is like gravity. All it takes is a little... push.
 
virgohippy's Avatar
 
Join Date: Feb 2006
Location: California
Posts: 1,679
Sparky speaks the truth, I did write my own cronjob wrapper a short while back. It wasn't so much to add/edit/remove jobs (much easier then writing a wrapper) as much to insure only one entity makes changes to my databases at a time.
__________________
~Warm and Fuzzy.
virgohippy is offline   Reply With Quote
Old 2008-08-15, 12:51 AM   #4
Star Man
A boy without mischief is like a bowling ball without a liquid center
 
Star Man's Avatar
 
Join Date: Feb 2006
Location: clevel.......don't make me say it!
Posts: 436
Maybe I can understand it just enough to use it.It would be pretty handy to have around.I hope I don't sound too dumb here cd34 but where the heck 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?
__________________
good luck
Star Man is offline   Reply With Quote
Old 2008-08-15, 01:39 AM   #5
cd34
a.k.a. Sparky
 
cd34's Avatar
 
Join Date: Sep 2004
Location: West Palm Beach, FL, USA
Posts: 2,396
Quote:
Originally Posted by Star Man View Post
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.
__________________
SnapReplay.com a different way to share photos - iPhone & Android
cd34 is offline   Reply With Quote
Old 2008-08-15, 04:55 AM   #6
Star Man
A boy without mischief is like a bowling ball without a liquid center
 
Star Man's Avatar
 
Join Date: Feb 2006
Location: clevel.......don't make me say it!
Posts: 436
Cool,thanks cd34
__________________
good luck
Star Man is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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

Forum Jump


All times are GMT -4. The time now is 10:22 AM.


Mark Read
Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
© Greenguy Marketing Inc