galvin Posted May 24, 2013 Share Posted May 24, 2013 So this CRON job was running every night and working fine, emailing me a backup of the SQL database. A few weeks ago it stopped and I can't figure out why because nothing changed with the database name, password, etc. I got this code from the internet a couple years ago so I'm wondering if maybe something about the code itself is outdated? Anyone have any thoughts? // Create the mysql backup file // edit this section $dbhost = "localhost"; // usually localhost $dbuser = "XXXXXX"; $dbpass = "XXXXXXX"; $dbname = "XXXXXXX"; $sendto = "XXXXX <XXXXXX@gmail.com>"; $sendfrom = "Automated Backup <backup@XXXXXX.com>"; $sendsubject = "Daily XXXXXXX Mysql Backup"; $bodyofemail = "Here is the daily XXXXX backup."; // don't need to edit below this section $backupfile = $dbname . date("Y-m-d") . '.sql'; system("mysqldump -h $dbhost -u $dbuser -p$dbpass $dbname > $backupfile"); // Mail the file include('Mail.php'); include('Mail/mime.php'); $message = new Mail_mime(); $text = "$bodyofemail"; $message->setTXTBody($text); $message->AddAttachment($backupfile); $body = $message->get(); $extraheaders = array("From"=>"$sendfrom", "Subject"=>"$sendsubject"); $headers = $message->headers($extraheaders); $mail = Mail::factory("mail"); $mail->send("$sendto", $headers, $body); // Delete the file from your server unlink($backupfile); Quote Link to comment Share on other sites More sharing options...
requinix Posted May 24, 2013 Share Posted May 24, 2013 "Stopped" meaning what? Cronjob not running? Script not generating backups? Not emailing them to you? Emailing an empty file? Quote Link to comment Share on other sites More sharing options...
galvin Posted May 24, 2013 Author Share Posted May 24, 2013 Sorry, the job is being called properly but this particular code is not emailing anything (i put other test code beore it and that ran fine). So I guess maybe just the email part of the code is not running since no email is being sent. Quote Link to comment Share on other sites More sharing options...
requinix Posted May 24, 2013 Share Posted May 24, 2013 What happens if you run the script manually? Quote Link to comment Share on other sites More sharing options...
Masterhacker Posted November 21, 2013 Share Posted November 21, 2013 Hello, how did you receive your problem i have the same problem it was working fine and know it stopped working Quote Link to comment Share on other sites More sharing options...
trq Posted November 21, 2013 Share Posted November 21, 2013 How do you know its the same problem? The op who made this post provided zero information. Quote Link to comment Share on other sites More sharing options...
requinix Posted November 21, 2013 Share Posted November 21, 2013 Hello, how did you receive your problem i have the same problem it was working fine and know it stopped workingConsidering how OP abandoned this thread six months ago I don't think you'll get an answer. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.