Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

cron job 1

Status
Not open for further replies.

spookie

Programmer
May 30, 2001
655
IN
hi all
can someone give me the information about cron job in PHP,
what they do?how it is done etc?

spookie
 
Well, PHP is not the language that does the cron job. There is a program on Linux machines called cron. There is also a similar program on Windows machine, but I do not know what its called.

PHP can execute that program by using the exec() function.

You can check out to see how its done.

Hope this helps.

-Vic

vic cherubini
krs-one@cnunited.com
====
Knows: Perl, HTML, JavScript, C/C++, PHP, Flash
====
 
thnaks cherubini
i know the function of exec() but the question is what exactly the cron does?
as far as i know it does a particular task on regular basis
but can u tell me how to set up a cron job?
say i want to send email every day on some specific time.can it be done thru cron?

thank you in advance

spookie
 
Oh. That I do not know how to do.

You might go to one of the Linux forums and ask there.

Sorry, I am no Linux guy.

-Vic vic cherubini
krs-one@cnunited.com
====
Knows: Perl, HTML, JavScript, C/C++, PHP, Flash
====
 
crontab is indeed a scheduler to run jobs at certain times. Sure, check the linux forum. Also searching on should find quick easy guides such as:


I find that the .edu college sites offer the best advice.

Basically, you can enter

->crontab -l to list your jobs
->crontab -r to remove them
->crontab -e to edit them

while your testing the best way I found was to create a file with pico called say cronjobs then issue a

->crontab cronjobs

cronjobs will look something like:

0 0 * * 0 /home/users/bofh/zaplogfiles

which runs a zaplogfiles batch on midnight every sunday.

Other considerations:

you have to leave a blank line after your last crontab entry else it wont work (dont know if true)

crontab will only start the job when it reaches the time - it won't backdate jobs if you submit them a few minutes after the scheduled time.

I dont know wether the jobs are triggered with reference to your hardware clock or you software clock - if things arent running on time then see if you can find a clocksync utility.
 
thanks SM777
it certainly added to my info
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top