homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

Test CRON on local machine
local machine/localhost

 6:09 pm on Jun 17, 2007 (gmt 0)

How could I test-run a CRON on a local machine?
Com-line or Putty does not find local host or
I never tried that before so I am clue less!
don't even know if it is possible?

How can I manage it on a local machine/localhost run by a WAMP



 8:16 pm on Jun 17, 2007 (gmt 0)

Ok first thing, CRON is done on a *nix and BSD based OS. So Mac and Linux.

Second, cron isn't accessed via the browser, but via the terminal (bash or tsch):

crontab -e

This open's VI (http://www.vim.org/) and you can add a cronjob, like so:

* * * * * command to be executed

[edited by: eelixduppy at 11:02 am (utc) on June 18, 2007]


 8:30 pm on Jun 17, 2007 (gmt 0)

I know, I access my servers cron via com line and putty SSH session as I do usually.
So to rephrase the question let's say: Is it possible to test a cron on a local MS machine running a lamp?
Or is there a way to mimic it? If not then to test locally
I need to reinstall RH9 on a local machine.

The reason why:
I have a nix test bed but I need to set a demo on my laptop


 8:38 pm on Jun 17, 2007 (gmt 0)

Well you can't run cron on a Windows box, but windows does have an alternative.

[edited by: eelixduppy at 11:03 am (utc) on June 18, 2007]


 12:55 pm on Jun 18, 2007 (gmt 0)

in windows they are called "scheduled tasks"


 11:10 pm on Jun 18, 2007 (gmt 0)

What exactly is cron?


 11:12 pm on Jun 18, 2007 (gmt 0)

also Henry, you may want to try vmware, it will allow one operating system to run "like" a program so to speak, ontop of another program. I think there website [vmware.com...]


 11:53 am on Jun 19, 2007 (gmt 0)

CRON is the "server clock" looks like the word root is from the greek chronos.

you may reach it and use it as follow
I made the following for a friend so here you go:

CRON (cron tables could be edited via the command line or using putty)

Using PUTTY:
Enter IP address
Left nav click SSH to expend and click again SSH

Move "BLOFISH" to the top of list
Click “open”

Enter your UN, press enter
Enter your PW, press enter (don't be surprised in Linux fashion the PW typing is hidden!)

Type in: crontab –e (space between crontab and –e)
If there are any pre-existing “jobs” from the server admin move those down two lines
to comment your job use ###########
Go back to the top and enter your task

Here we use wget()
To use wget() you need to ensure that it is installed
Type in the PICO: wget –help press enter
If you get a bunch of information then you are OK

Type in the PICO:
1 */3 * * * wget [my_web...]
Ex: should run the first minute of every three hours (8 times a day)
Press enter
Last: Press ctrl and x to exit
You will be asked to type Y or N
Type your answer
Press enter
That’s it done!
FYI: bottom of PICO shows a list of commands
Each starting with “ ^ “ do not type the ^ it only means: Press CTRL :)

PHP script:
Needs to be shmod at: 755

in order to write your task you may search for cron tutorials and find about the correct timing syntax
I did not mention what it could be used for:
You could need to perform a scheduled task such as emailing or DB backup daily or whenever
so you write (Here a PHP script) to do the job and CRON will fire it for you.
you could ask why using it, well the script needs to be parsed and the server browser will parse it for you.

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved