what are cron jobs?

lockmac

Senior member
Dec 5, 2004
603
0
0
Hi there. I am looking at getting a job over summer (im a uni student) and my uni has showed me this job advertisement. I am a PHP programmer, but im not sure what cron jobs are. Just wandering if someone could explain to me what they are? I reall dont want to email the employer asking what the cron jobs are as this would sound incompetent.

Here is the add...

Thanks guys

Summary:
PHP Programmer required to update and maintain existing software using cron jobs. Details
PHP programmer required
Casual / Contract position located in Springvale
Home based work
Immediate start
 

lockmac

Senior member
Dec 5, 2004
603
0
0
yeh i foudn that but couldnt quite understand how it would relate to php. any ideas what it would be about? they are a company that sell second hand computers and their website is pretty basic...
 
Aug 25, 2004
11,151
1
81
First, understand the basics of cron jobs and how to view/change them (crontab -l, crontab -e).

There are many many reasons why anyone would run a cron job. It relates more to the website in general than PHP specifically.

You can have cron run anything that you could type into a console. So "rm -Rf log.txt" and "./myawesomescript.sh" would be valid entries in your crontab (I've excluded the * * * * * variables).

Since PHP can also be run from the console, for example "/usr/bin/php ~/website/cronjobthingy.php", you can also add this to your cron tab like so:

28 1 * * * /usr/bin/php ~/website/cronjobthingy.php > /dev/null

In this case, I'm dumping the output of the PHP file to ensure I don't get an email from cron UNLESS an error occured.

 

FeuerFrei

Diamond Member
Mar 30, 2005
9,144
929
126
Sounds like the equivalent of a mainframe job scheduler where the jobs themselves are written in JCL (JobControlLanguage).
 

sourceninja

Diamond Member
Mar 8, 2005
8,805
65
91
Originally posted by: George P Burdell
First, understand the basics of cron jobs and how to view/change them (crontab -l, crontab -e).

There are many many reasons why anyone would run a cron job. It relates more to the website in general than PHP specifically.

You can have cron run anything that you could type into a console. So "rm -Rf log.txt" and "./myawesomescript.sh" would be valid entries in your crontab (I've excluded the * * * * * variables).

Since PHP can also be run from the console, for example "/usr/bin/php ~/website/cronjobthingy.php", you can also add this to your cron tab like so:

28 1 * * * /usr/bin/php ~/website/cronjobthingy.php > /dev/null

In this case, I'm dumping the output of the PHP file to ensure I don't get an email from cron UNLESS an error occured.

Yup, crons are just the unix way of scheduling tasks. Not much magical or powerful about them. Basically they have some php scripts that run automatically and they need someone to update them. This is different the traditional website php work. PHP is sometimes used as a shell scripting language in linux (I confess I've done it once or twice).