navigation
a webmaster learning community
     Home    Register     Search      Help      Login    
Sponsors

Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions.

Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.

Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax

Search Forums
 

Advanced search
Recent Posts

 Todays Posts
 Most Active posts
 Posts since last visit
 My Recent Posts
 Mark posts read

Microsoft MVP

 

Cron Jobs?

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> Server Issues >> Cron Jobs?
Page: [1]
 
markhawker

 

Posts: 511
Joined: 5/31/2004
From: Leeds, UK
Status: offline

 
Cron Jobs? - 7/9/2004 13:21:24   
Hi, what exactly are cron jobs? I understand you can automate server processes with them, schedule them to run at specific times, but what types of commands can you run? I've posted rather than read up on the matter as descriptions sometimes can be a bit wiry and it's best to hear 'from the horses mouth' so to speak.

Mark


_____________________________

Mark Hawker
my business - http://www.thebubblejungle.com/
facebook - http://www.thebubblejungle.com/facebook/
web hosting - http://www.crucialp.com/
ou812

 

Posts: 1589
Joined: 1/5/2002
From: San Diego
Status: offline

 
RE: Cron Jobs? - 7/9/2004 14:38:04   
cron jobs, or crontabs, are run from cron, a daemon. The cron allows crontab entries to be run at specified times (month, weekday, days of month, hours of day, hours, minutes etc.). So basically a crontab is a command or script, with whatever you want your script to do, that is executed by cron on a specific time(s).

Does that help?

-brian

(in reply to markhawker)
dpf

 

Posts: 7123
Joined: 11/12/2003
From: India-napolis
Status: offline

 
RE: Cron Jobs? - 7/9/2004 14:50:32   
quote:

from cron, a daemon

so what is "a daemon"?

_____________________________

Dan

(in reply to ou812)
bobby

 

Posts: 11394
Joined: 8/15/1969
From: Seattle WA USA
Status: offline

 
RE: Cron Jobs? - 7/9/2004 14:54:18   
cron is also a Unix/Linux command... not on Windows servers...

the most basic way to describe a daemon is a program or utility that runs in the background relatively unseen...

_____________________________

If con is the opposite of pro, is Congress the opposite of progress?


:)

(in reply to dpf)
dpf

 

Posts: 7123
Joined: 11/12/2003
From: India-napolis
Status: offline

 
RE: Cron Jobs? - 7/9/2004 14:59:07   
I see....sort of like my daughter when there is housework to be done! thanks

_____________________________

Dan

(in reply to bobby)
Shirley

 

Posts: 3127
Joined: 1/8/1999
From: Omaha, Ne USA
Status: offline

 
RE: Cron Jobs? - 7/9/2004 16:01:59   
quote:

cron is also a Unix/Linux command... not on Windows servers...


Windows 2003 server has scheduled tasks which accomplish the objective... to run a script or program at a scheduled time.

_____________________________


Everything But Cake


(in reply to dpf)
markhawker

 

Posts: 511
Joined: 5/31/2004
From: Leeds, UK
Status: offline

 
RE: Cron Jobs? - 7/9/2004 17:40:10   
Thanks, but what type of commands can be run? The server I am on is Linux so that makes sense. Pardon my ignorance!

_____________________________

Mark Hawker
my business - http://www.thebubblejungle.com/
facebook - http://www.thebubblejungle.com/facebook/
web hosting - http://www.crucialp.com/

(in reply to Shirley)
bobby

 

Posts: 11394
Joined: 8/15/1969
From: Seattle WA USA
Status: offline

 
RE: Cron Jobs? - 7/9/2004 17:53:08   
check this out:

http://www.unixgeeks.org/security/newbie/unix/cron-1.html

You may not be able to run cron on a hosted server. You likely won't have permissions to run shell commands... but who knows? It will likely depend on the host, etc.

I've used cron on my desktop at home to schedule updates and such...

_____________________________

If con is the opposite of pro, is Congress the opposite of progress?


:)

(in reply to markhawker)
ellipisces

 

Posts: 849
Joined: 12/14/2003
Status: offline

 
RE: Cron Jobs? - 7/12/2004 4:44:30   
cron is a command line interface...

as such you can run almost any linux program from a cron job, (if any of you remember DOSKEY), and you can batch them so it could go like this...

connect to network drive n:
scan n: for virus
backup n:

_____________________________


(in reply to markhawker)
abbeyvet

 

Posts: 5095
From: Kilkenny Ireland
Status: offline

 
RE: Cron Jobs? - 7/12/2004 11:52:02   
The easiset way to explain this is by using an example.

First the Cron daemon.

Basically it is a little program that runs all the time on Linux servers, in the background, unnoticed and mostly doing nothing at all. Every so often (usually every minute), it checks to see if there is anything it should do.

If you want to do something on your site or on the server at a specific time every so-many days, you just need something that the daemon will see when it looks and obey.

This is called a crontab. It's just a file that has information about the minute, hour, day of month or day of week a specific command should be run. When the daemon sees this, it obediently causes the command to run at the given time.

In practical terms, this is very handy.

For example, on a site I manage we send out a newsletter to several thousand people every week. Some messages bounce, sometimes because an address is temporarily unavailable, sometimes because it has disappeared forever.

Dealing with this by hand is a big pain.

So, we have a little program that handles the bounces, resending mail twice in case of errors and then suspending the addresses from the list if they bounce more than twice - on the assumption that at that point they are dead.

This is the command that is in the crontab to make that all happen.


30 1 * * * /usr/bin/wget -O /dev/null -T 0 http://www.domain.com/mail/dailymail.php?pw=passowrd



That looks horrible - but break it down and it is simpler.

30 1 * * *

This bit says when the job should be done, in the order minute | hour | day of month | month | day of week

So my command will run at 1.30 am every day, as I have * * * for day of month, month, and day of week so they are ignored.

another example:

30 1 4 5 *

that could be used to send a birthday greeting to someone at 1.30 am on the 4th of May each year :)


The next bits are pretty grim looking:

/usr/bin/wget

This is the command bit - wget is a little tool that grabs a web page, so basically this is saying "go to wget, which is in the directory /usr/bin, and tell it this......"

what it tells it is:

-O /dev/null

which if you are wget means "get the page but do not output it to a browser as you normally would, just run it".

-T 0

This tells it not to time out - in other words to stick with the task it is being given!

http://www.domain.com/mail/dailymail.php?pw=password

This tells it the page to get, and the password it needs to get into it.


Once that has been done the page dailymail.php will run on the server and the code in it will do whatever it has been written to do, which in this case is resend bounced messages.



It's important to note here that Cron did nothing much - all the work was done by the file dailymail.php. All the cron task did was find the file and run it at a specific time. That is what Cron is almost always used for - running a specified program or script at a specified time.

Some hosting setups allow you to enter your own cron tasks, but most do not. However your host will almost certainly be happy to set one up for you.

_____________________________

Katherine

:: InKK Design :: InKK Domains

(in reply to ellipisces)
mrdance

 

Posts: 1
Joined: 7/27/2004
Status: offline

 
RE: Cron Jobs? - 7/27/2004 12:00:18   
I recommend using VisualCron. It like cron - but for windows.

You can read more here at it's homepage: www.visualcron.com

regards/ Henrik

(in reply to markhawker)
markhawker

 

Posts: 511
Joined: 5/31/2004
From: Leeds, UK
Status: offline

 
RE: Cron Jobs? - 7/29/2004 9:38:56   
Thanks for the reply Katherine, a very useful and informative read. I'll have a look at the link too Henrik, thanks.

Regards,


_____________________________

Mark Hawker
my business - http://www.thebubblejungle.com/
facebook - http://www.thebubblejungle.com/facebook/
web hosting - http://www.crucialp.com/

(in reply to mrdance)
Page:   [1]

All Forums >> Web Development >> Server Issues >> Cron Jobs?
Page: [1]
Jump to: 1





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts