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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.