PDA

View Full Version : Cron Job error


Bubbs
11-08-2006, 10:18 AM
I created a Cron Job to backup a Points Databas for a Gaming Clan.

Here is the scripts... I changed the server / PW infor to proteect the innocent :)

<?php
set_time_limit(600);

mysql_backup('database', 'user', 'PW');

function mysql_backup($dbname, $dbuser, $dbpass)
{
$old_umask = umask(0);
shell_exec('mysqldump --user=' . $dbuser . ' --password=' . $dbpass . ' --add-drop-table --complete-insert ' . $dbname . ' | gzip > backup/' . $dbname . '/' . date('mdy_H') . '-' . $dbname . '.sql.gz');
umask($old_umask);
}
?>

Here is the error I receive via Email when it runs the cron job at night:
/bin/sh: http://www.yoursitename.com/eqdkp/eqdkpbackup.php: No such file or directory
For some reason it is adding a ":" after the file name and I can;t seem to figure out why.

any ideas?

sabbott64
11-08-2006, 10:29 AM
My first question would be to ask if you have a backup directory at the root level of your account. Since you don't specify a fixed location for the backup directory it's going to try to place it relative to the default location, which is going to be /home.

I don't know that it's not finding your cron job php file as much as it's the php file failing to run because of an error in the code.

Try commenting out the shell_exec line and then running the cron job. If it still fails then I'm wrong and it can't find the php file to run. If it runs successfully then there's a problem with the shell_exec line which will need to be fixed.

Steve

Bubbs
11-08-2006, 11:15 AM
I run the script by typing out the path in IE and it creates a backup by just fine. The problem is Cron Jobs is looking for a file with the right path but with a : at the end and I'm not sure why.