Welcome to WebmasterWorld Guest from 54.162.226.212

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Test CRON on local machine

local machine/localhost

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

WebmasterWorld Senior Member henry0 is a WebmasterWorld Top Contributor of All Time 10+ Year Member



How could I test-run a CRON on a local machine?
Com-line or Putty does not find local host or 127.0.0.1
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)

WebmasterWorld Senior Member 10+ Year Member



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)

WebmasterWorld Senior Member henry0 is a WebmasterWorld Top Contributor of All Time 10+ Year Member



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)

WebmasterWorld Senior Member 10+ Year Member



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)

WebmasterWorld Administrator jatar_k is a WebmasterWorld Top Contributor of All Time 10+ Year Member



in windows they are called "scheduled tasks"
11:10 pm on Jun 18, 2007 (gmt 0)

5+ Year Member



What exactly is cron?
11:12 pm on Jun 18, 2007 (gmt 0)

5+ Year Member



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)

WebmasterWorld Senior Member henry0 is a WebmasterWorld Top Contributor of All Time 10+ Year Member



thanks
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”

Using PICO editor: (PUTTY DEFAULT EDITOR)
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
<edit>
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.
</edit>
 

Featured Threads

Hot Threads This Week

Hot Threads This Month