Solved

CronTab to execute PHP code

Posted on 2004-10-11
3
853 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
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

ScreenConnect 6.0 Free Trial

Discover new time-saving features in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Checking CSRF token within a function 36 76
mysql update statement 3 23
UPDATE query not working in mysqli php 8 52
mysql date time 14 31
These days socially coordinated efforts have turned into a critical requirement for enterprises.
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

810 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