Jump to content

Recommended Posts

Posted

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!

Posted

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

Posted (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 by ShrikarG
  • 2 months later...

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.

Loading...
×
×
  • Create New...