Greenguy's Board

Greenguy's Board (http://www.greenguysboard.com/board/index.php)
-   Programming & Scripting (http://www.greenguysboard.com/board/forumdisplay.php?f=15)
-   -   Dumb Q - What is a cron job? (http://www.greenguysboard.com/board/showthread.php?t=48478)

Tekster 2008-08-14 06:57 PM

Dumb Q - What is a cron job?
 
...and how do you set one up? (Blogs Automater)

I feel like such a dumb ass. |pokefun|TA

cd34 2008-08-14 07:03 PM

cron is a utility for executing a task at a particular time.

If I recall, Blogs automator has a suggested entry of a few cron lines that need to be added. If you are comfortable with ssh, you can do that, or, you can use the cron job entry in your control panel (advanced will allow you to just paste in their entries).

Ms Naughty 2008-08-14 07:22 PM

TA... I'm still vague on cron jobs too. I *almost* got what Sparky just said. It would probably help if one of my hosts actually had a control panel for me to use.

Star Man 2008-08-14 07:25 PM

Quote:

Originally Posted by TekAngel (Post 415044)
I feel like such a dumb ass. |pokefun|TA

Don't feel bad Tek Angel,I clicked on this thread thinking I was going to learn a new way to degrade woman!|bananna|

Actually I'd love to use cron to automatically update my site daily but have no clue how to do it.

Ramster 2008-08-14 08:21 PM

In dumb man's terms (that's what I understand, LOL) a cron job is added by your host (it's always easier to ask them to do it) to the server to tell a particular script to do something at a specific time.

For example a tgp script can have a cron that will update it at midnight or 3am each and every day. As sparky said, blogs automater has one that tells the blog to update.

T Pat 2008-08-14 08:24 PM

Hey Mike I sent in a support ticket to Sparky to get the cronjobs setup for my BA

LeRoy 2008-08-14 08:45 PM

Quote:

Originally Posted by cd34 (Post 415047)
cron is a utility for executing a task at a particular time.

If I recall, Blogs automator has a suggested entry of a few cron lines that need to be added. If you are comfortable with ssh, you can do that, or, you can use the cron job entry in your control panel (advanced will allow you to just paste in their entries).

Hi Cd34,

Can the cron be used with quickbooks and X-Cart?

I have a client "CN2 Data" that wants the orders from the cart automatically entered into quickbooks.

Can the cron feature do this?

LD 2008-08-14 09:16 PM

Quote:

Originally Posted by T Pat (Post 415071)
Hey Mike I sent in a support ticket to Sparky to get the cronjobs setup for my BA

Yep, that's what I did, too. They can do it in their sleep...give yourself a break....:)

Cleo 2008-08-14 09:26 PM

I just think of cron as a really convoluted time clock with very hard to use tabs.

I always love it when I setup a crontab to do something once a day but due to the wonderful user friendliness of Vi and the cron interface end up having it do it once each second.

CronniX is a wonderful easy to use Mac application that I use for setting up crontabs.

Star Man 2008-08-14 09:36 PM

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?

cd34 2008-08-14 09:58 PM

Quote:

Originally Posted by D2222 (Post 415076)
Hi Cd34,

Can the cron be used with quickbooks and X-Cart?

I have a client "CN2 Data" that wants the orders from the cart automatically entered into quickbooks.

Can the cron feature do this?

cron could do an export on a 'scheduled' basis from xcart (I think xcart's quickbook export feature is called from a script) and then the output attached to an email, but, having it automatically update quickbooks may not work.

the .iif format is well documented so, that's not an issue, but, they would still have to possibly doubleclick the attachment or go into quickbooks and hit 'import'

cd34 2008-08-14 10:00 PM

Quote:

Originally Posted by Star Man (Post 415082)
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.

virgohippy 2008-08-14 11:04 PM

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.

Star Man 2008-08-14 11:51 PM

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? |huh

LeRoy 2008-08-15 12:00 AM

Quote:

Originally Posted by cd34 (Post 415086)
cron could do an export on a 'scheduled' basis from xcart (I think xcart's quickbook export feature is called from a script) and then the output attached to an email, but, having it automatically update quickbooks may not work.

the .iif format is well documented so, that's not an issue, but, they would still have to possibly doubleclick the attachment or go into quickbooks and hit 'import'

Thanks cd34.

Helpful as always :)

Tekster 2008-08-15 12:17 AM

Quote:

Originally Posted by T Pat (Post 415071)
Hey Mike I sent in a support ticket to Sparky to get the cronjobs setup for my BA

I am going to try and figure it out first, if I run into a problem I will do the same as you. |smurf| (I just like the Smurf)

Tekster 2008-08-15 12:19 AM

Quote:

Originally Posted by Cleo (Post 415080)
....

CronniX is a wonderful easy to use Mac application that I use for setting up crontabs.

Thanks Cleo, that looks like it would help. |thumb |smurf| (I really like the Smurf)

cd34 2008-08-15 12:39 AM

Quote:

Originally Posted by Star Man (Post 415105)
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? |huh

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.

Star Man 2008-08-15 03:55 AM

Cool,thanks cd34 |thumb


All times are GMT -4. The time now is 06:37 PM.

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