Jump to content

php script issue with cron


Imaulle

Recommended Posts

Hello,

 

I have a php script that I'm trying to have run from a different server via cron

 

1 9 * * * /usr/bin/wget wget -o http://www.site1.com/update.php -o /dev/null

 

The log in /var/log/cron is showing this as having been run:

 

Dec 26 09:01:01 host crond[10392]: (root) CMD (/usr/bin/wget wget -o http://www.site1.com/update.php -o /dev/null)
Dec 27 09:01:01 host crond[17001]: (root) CMD (/usr/bin/wget wget -o http://www.site1.com/update.php -o /dev/null)
Dec 28 09:01:01 host crond[2331]: (root) CMD (/usr/bin/wget wget -o http://www.site1.com/update.php -o /dev/null)

 

 

however it does not appear to run successful (or at least nothing gets updated) :(

 

 

Here is the update.php

 

<?php
require_once('functions.php');
mysql_connect("localhost","username","password");
mysql_select_db("database");
$result = mysql_query("SELECT * FROM ServerList");
while($row = mysql_fetch_array($result)){
  $server = new Whm;
  $server->init($row['HostName'],$row['UserName'],$row['PassHash']);
  $NewUsedSlots = count($server->listaccts());
  mysql_query("UPDATE ServerList SET UsedSlots='$NewUsedSlots' WHERE HostName='{$row['HostName']}'");
}
$CurrentTime = date("Y-m-d G:i");
mysql_query("UPDATE UpdateTime SET TimeUpdated='$CurrentTime'");
?>

 

 

update.php does in fact work correctly when I run it from my own personal browser..

 

 

what is going wrong? :(

 

 

thanks!

Link to comment
https://forums.phpfreaks.com/topic/222912-php-script-issue-with-cron/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.