TennShadow Posted December 12, 2016 Report Posted December 12, 2016 Hey guy, I'm looking for a backup script I can run as a cron job that will backup, compress, and the email me my databases nightly. I had a script several years ago that did just that but I don't have it anymore and my googling magic is not strong on this one. My host backups my site daily but I want the added protection of my databases being backed up off site from the host. Any help would be great. Thanks! Quote
ShrikarG Posted December 12, 2016 Report Posted December 12, 2016 Even I am looking for such a script. Right now I am doing in manually every night Quote
Members Vangelis Posted December 12, 2016 Members Report Posted December 12, 2016 Ask and it will be given to you Matthew 7:7 backup.php Put the backup.php in your admin folder and you can call it in the crop by getting the address from here by replacing maintenance.php with backup.php Quote
TennShadow Posted December 13, 2016 Author Report Posted December 13, 2016 Awesome - thank you for this. I got a couple errors with this. First, it didn't like my complex password until I put the password in quotes. Then that error went away but then got a different one. No backup file is created or emailed. I did get the email that the file was suppose to be attached to but there was nothing attached due to the below errors. This was in the error logs. [13-Dec-2016 00:25:01 UTC] PHP Warning: session_start(): Cannot send session cookie - headers already sent in /home/xxxxxx/public_html/core/codon.config.php on line 40 [13-Dec-2016 00:25:01 UTC] PHP Warning: session_start(): Cannot send session cache limiter - headers already sent in /home/xxxxxx/public_html/core/codon.config.php on line 40 This is from the email it sent me. <br /> <b>Notice</b>: Undefined index: DOCUMENT_ROOT in <b>/home/xxxxxx/public_html/admin/backup.php</b> on line <b>35</b><br /> <br /> <b>Notice</b>: Use of undefined constant localhost - assumed 'localhost' in <b>/home/xxxxxx/public_html/admin/backup.php</b> on line <b>37</b><br /> <br /> <b>Notice</b>: Use of undefined constant MYDBNAME_REMOVED - assumed 'MYDBNAME_REMOVED' in <b>/home/xxxxxx/public_html/admin/backup.php</b> on line <b>38</b><br /> <br /> <b>Notice</b>: Use of undefined constant MYDBNAME_REMOVED - assumed 'MYDBNAME_REMOVED' in <b>/home/xxxxxx/public_html/admin/backup.php</b> on line <b>40</b><br /> sh: -c: line 0: syntax error near unexpected token `)' sh: -c: line 0: `mysqldump --hex-blob --routines --skip-lock-tables --log-error=mysqldump_error.log -h localhost -u MYDBNAME_REMOVED -pPASSWORD MYDBNAME_REMOVED > 20161213_MYDBNAME.sql' mysqldump for localhost : MYDBNAME_REMOVED failed with a return code of 1 Error message was: tail: cannot open `mysqldump_error.log' for reading: No such file or directory - Backup Completed Quote
ShrikarG Posted December 13, 2016 Report Posted December 13, 2016 (edited) [13-Dec-2016 04:24:01 Etc/GMT] PHP Warning: session_start(): Cannot send session cookie - headers already sent in /home/litejoro/public_html/crew/core/codon.config.php on line 40 [13-Dec-2016 04:24:01 Etc/GMT] PHP Warning: session_start(): Cannot send session cache limiter - headers already sent in /home/litejoro/public_html/crew/core/codon.config.php on line 40 [13-Dec-2016 04:24:01 Etc/GMT] PHP Warning: Creating default object from empty value in /home/litejoro/public_html/crew/admin/backup.php on line 26 [13-Dec-2016 04:24:01 Etc/GMT] PHP Notice: Undefined index: DOCUMENT_ROOT in /home/litejoro/public_html/crew/admin/backup.php on line 35 I have these errors too but a backup File is getting created. Is the script supposed to email you with the SQL database attached to the email? This is what I get in email : <br /> <b>Warning</b>: Creating default object from empty value in <b>/home/litejoro/public_html/crew/admin/backup.php</b> on line <b>26</b><br /> <br /> <b>Notice</b>: Undefined index: DOCUMENT_ROOT in <b>/home/litejoro/public_html/crew/admin/backup.php</b> on line <b>35</b><br /> Warning: Using a password on the command line interface can be insecure. Backup Completed Edited December 13, 2016 by ShrikarG Quote
Members Vangelis Posted December 13, 2016 Members Report Posted December 13, 2016 Yes it should send you the mysql file by email Quote
ShrikarG Posted December 13, 2016 Report Posted December 13, 2016 (edited) @Keith .If you find a solution , please let us know. Edited December 13, 2016 by ShrikarG Quote
OmerAslan Posted February 16, 2017 Report Posted February 16, 2017 This is so helpful. I download also but i get empty email. Anyway to fix this? Quote
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.