Solved

CronTab to execute PHP code

Posted on 2004-10-11
3
861 Views
Last Modified: 2012-06-27
Hi,

I have a status.php webpage that needs executing via a cronjob every 60 seconds, I use directadmin as the control panel, how do I enter the cronjob code to load that webpage every 60 seconds so it can do its job ?

Cheers
0
Comment
Question by:MirageSF
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 12

Expert Comment

by:minichicken
ID: 12275874
If you can set the time schedure in directadmin with a interface, then all you need is to enter the command which is something like this:

GET my_path/status.php

0
 
LVL 1

Accepted Solution

by:
gportal earned 50 total points
ID: 12351979
I'm not greatly up on DirectAdmin, so forgive me if I'm wrong...!

Set the mins, hours, days, months, etc, to * each,

You'll then need to enter the location of the php parser, and the location of the script into the Command box, like such:

/usr/bin/php /home/gportal/public_html/status.php

OR, if you don't want the mails being sent to you each time it outputs, try:

/usr/bin/php /home/gportal/public_html/status.php >> /dev/null 2>&1

Finally, an alternative is to add the php parser shebang to the top line of your script, permission it as an executable, and run it on its own right...

add: #!/usr/bin/php as line 1,

cron as: /home/gportal/public_html/status.php >> /dev/null 2>&1

If i'm waaaaaay of with the Direct Admin thing, let me know, and I may have a poke at it! :D
0
 
LVL 5

Expert Comment

by:crimson117
ID: 12377598
if you can put your php file on a webserver, put this command in your crontab:

lynx -dump http://www.yoursite.com/yourphpfile.php


Lynx is a text-based web browser.  The -dump option will dump the output of the php page to the standard output, so cron can do what you want with it (perhaps email it to the owner of the cron job?)
0

Featured Post

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this. Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it i…
These days socially coordinated efforts have turned into a critical requirement for enterprises.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

635 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question