TotalChoice Hosting Family Forums: Backup Your Database Often - TotalChoice Hosting Family Forums

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Backup Your Database Often Just a friendly reminder

#1 User is offline   surefire 

  • Immediate Family
  • PipPipPipPip
  • Group: Members
  • Posts: 1,011
  • Joined: 09-May 03

Posted 11 June 2003 - 09:28 PM

It's a VERY good practice to backup your mysql database often. How often depends on how important your data is.

On my job posting site, I'd hate to have to tell a member that their resume is gone. So I backup daily.

Directions.

1- Cpanel
2- phpMyAdmin
3- Click on your database (not the tables, the actual database link above your tables)
4- in the main window, click Export
5- Choose 'Structure and Data', 'Save as File' and any other features you want
6- submit, choose the location to download and store the textfile on your computer

Repeat as often as you like.

Having good security measures in place is good, but there's nothing like having a solid backup of your database in case all h*ll breaks loose.

Also, from experience I can tell you that the biggest threat comes from within. Backup your database before testing out that new script you wrote. I once zapped a precious table of data with one of my own scripts.

And if you don't have a backup and something goes wrong, your only chance at salvation is to ask the Help Desk if they can rescue you, but you need to ask immediately. And ask nicely. ;)

#2 User is offline   Lianna 

  • Immediate Family
  • PipPipPipPip
  • Group: Members
  • Posts: 2,385
  • Joined: 03-November 02

Posted 11 June 2003 - 10:36 PM

Ok, let's say that I want a backup made of my db everyday and archiving the most recent 5, automatically. Ideas?

:unsure:

#3 User is offline   surefire 

  • Immediate Family
  • PipPipPipPip
  • Group: Members
  • Posts: 1,011
  • Joined: 09-May 03

Posted 11 June 2003 - 11:15 PM

I've been meaning to look for a backup script. I seem to recall a thread at TCH that had a link to such a script and gave a cron command to execute it.

I think it would also be pretty cool if such a script could email the dump file (backup) in an atachment... not sure if that's possible or not.

I'll look into this and post my findings.

#4 User is offline   surefire 

  • Immediate Family
  • PipPipPipPip
  • Group: Members
  • Posts: 1,011
  • Joined: 09-May 03

Posted 11 June 2003 - 11:47 PM

This looks VERY promising.

http://www.phpfreaks...ipt/view/11.php


Can't wait to try it. (Note to self... manually backup db before testing this new script.)

#5 User is offline   TCH-Rick 

  • Technical Support Services Manager
  • PipPipPipPip
  • Group: Members
  • Posts: 1,855
  • Joined: 20-January 03

Posted 12 June 2003 - 01:54 AM

Great find, Jack. I downloaded and installed the script and tested it on my test account and it seems to work fine. It is fairly easy to set up (probably easier if you don't set it up at 2 in the morning) and runs fine using crontab.

I set it up outside of my public_html directory and made the changes to the file as explained in the comments.

I then set up a crontab to run it every day in the middle of the night and used /home/username/dbsender.php as the command. I set the permissions to 770.

When the file runs and will use gzip to compress the file then send the file to you via email or ftp.

#6 User is offline   borfast 

  • Immediate Family
  • PipPipPipPip
  • Group: Members
  • Posts: 3,276
  • Joined: 04-January 03

Posted 12 June 2003 - 06:32 AM

Yep, that's the script I found some time ago and posted somewhere here at the forums.

After changing the variables to suit your needs, you can set up the cron job with a command such as this:

php -q /home/best-alm/public_html/mysql_backup/dbsender.php

and the timing you find appropriate.

Remember to set the appropriate permissions to the folder where you want the script to save your backups.

Oh, and you might want to change line 67 from this:

passthru("mysqldump --opt -h$dbhost -u$dbuser -p$dbpass $dbname >$filename");

into this:

passthru("mysqldump --add-drop-table --add-locks --all --extended-insert --quick -h$dbhost -u$dbuser -p$dbpass $dbname >$filename");
Raul Santos
-=[ http://www.borfast.com ]=-
Because the people who are crazy enough to think they can change the world, are the ones who do!
Get Firefox!

#7 User is offline   surefire 

  • Immediate Family
  • PipPipPipPip
  • Group: Members
  • Posts: 1,011
  • Joined: 09-May 03

Posted 12 June 2003 - 11:31 AM

Thanks for the help!

#8 User is offline   btrfld 

  • Immediate Family
  • PipPipPipPip
  • Group: Members
  • Posts: 594
  • Joined: 22-January 03

Posted 12 June 2003 - 03:03 PM

I downloaded the file, but can't open it on my Windows machine. So I uploaded it to a folder on my TCH site, and tried to extract it in File Manager. I get the following error:

Quote

tar: This does not look like a tar archive
tar: Skipping to next header
tar: Error exit delayed from previous errors


What am I missing?
- Jim
"Be the change you want to see in the world." - Ghandi
Think Locally. Act Personally.

#9 User is offline   surefire 

  • Immediate Family
  • PipPipPipPip
  • Group: Members
  • Posts: 1,011
  • Joined: 09-May 03

Posted 12 June 2003 - 07:04 PM

This is a very small one page script. You should be able to extract the file onto your hard drive and ftp it to your site after you read the directions in the script.

I haven't had time today to mess with it. But I looked at the code and it's pretty straightforward.

#10 User is offline   leezard 

  • Immediate Family
  • PipPipPipPip
  • Group: Members
  • Posts: 550
  • Joined: 21-April 03

Posted 12 June 2003 - 07:35 PM

Ok, I'm gonna try and set this up (I'm not very good at remembering to do backups) I do have 1 question tho, i have 4 different dbases on my site, can i install this script in 4 different folders and configure it for each dbase?

#11 User is offline   Lianna 

  • Immediate Family
  • PipPipPipPip
  • Group: Members
  • Posts: 2,385
  • Joined: 03-November 02

Posted 12 June 2003 - 07:56 PM

*YAY* New toys! Thanks all.

:P

#12 User is offline   surefire 

  • Immediate Family
  • PipPipPipPip
  • Group: Members
  • Posts: 1,011
  • Joined: 09-May 03

Posted 12 June 2003 - 09:33 PM

leezard, on Jun 12 2003, 07:35 PM, said:

Ok, I'm gonna try and set this up (I'm not very good at remembering to do backups) I do have 1 question tho, i have 4 different dbases on my site, can i install this script in 4 different folders and configure it for each dbase?

I can't think of any reason why not.

Another solution would be to amend the script to backup each of the db's to the same folder so you have one directory and one script and one cron job.

But let's use the KISS method... unless you're feeling bold, I'd do this

1- manually back up everything
2- read the directions for the script
3- test it out on one database
4- if successful, roll it out to the other three

This post has been edited by borfast: 11 October 2003 - 07:28 AM


#13 User is offline   Lianna 

  • Immediate Family
  • PipPipPipPip
  • Group: Members
  • Posts: 2,385
  • Joined: 03-November 02

Posted 12 June 2003 - 10:10 PM

Thanks Rick (who just implemented the script on one of my db's and saved me a ton of time having to actually learn something)! :D You rock!

#14 User is offline   TCH-Rick 

  • Technical Support Services Manager
  • PipPipPipPip
  • Group: Members
  • Posts: 1,855
  • Joined: 20-January 03

Posted 12 June 2003 - 10:24 PM

<resist>urge to make comment about old dogs and new tricks</resist> :)

I did a little more testing and here is how I set my account up to send multiple db's.

1. I created an empty file in the directory I wanted to use and copied the script into it. I named this file send_mt.php.

2. I editted the file to the information about my Movable Type db. Set the email and other options, etc.

3. Created a Cron to run this script every other min.

4. Editted stupid typos and changed the permission of the file to 770 (after the first backup didn't get made.)

5. Got a good backup sent after repeating step 4 a time or two. (Really shouldn't watch TV while doing this)

6. Changed the cron to send once a day in the middle of the night.

7. Copied the seditted script to another empty file and named it send_forum.php.

8. Changed data about the database.

9. Copied cron statement from first one and did step 3.

10. Changed name of file in second cron to send_forum.php from send_mt.php after not receiving the backup when expected.

11. Changed cron to run once a day in the middle of the night after receiving backup file.

12. Got a cold beverage.

Bottom line -- changing the names of the files and setting separate crons works and all files can be in the same directory.

This post has been edited by Rickvz: 12 June 2003 - 10:24 PM


#15 User is offline   surefire 

  • Immediate Family
  • PipPipPipPip
  • Group: Members
  • Posts: 1,011
  • Joined: 09-May 03

Posted 12 June 2003 - 11:02 PM

Rick, if you don't mind... would you be able to post an example of the cron you wrote... as close to the real deal as possible.

It seems that writing cron gives lots of us difficulties. (Yours truly included)

Thanks.

#16 User is offline   TCH-Rick 

  • Technical Support Services Manager
  • PipPipPipPip
  • Group: Members
  • Posts: 1,855
  • Joined: 20-January 03

Posted 12 June 2003 - 11:14 PM

I just put in /home/username/scriptdir/filename.php for the cron entry.

Note that I installed the script below the /public_html directory so it is not easily visible on the web so you won't be able to run it manually. If it is in public_html you would use /home/user/public_html/scriptdir/filename.php. You would be able to run it manually. Not sure what would happen if you had it in a protected directory.

A couple of trouble shooting tips:

If it doesn't run check that the permissions allow executing and that the filename in the cron is right.

If it returns an empty file then check that the directory you put in the script is where the file resides.

#17 User is offline   arvind 

  • Immediate Family
  • PipPipPipPip
  • Group: Members
  • Posts: 482
  • Joined: 21-August 03

  Posted 25 September 2003 - 08:23 AM

I can't seem 2 get it to work. I've edited it correctly. But when I run the script i get the following error

Quote

Warning: filetype(): Lstat failed for (null) (errno=2 - No such file or directory) in /home/******/public_html/dbsender/dbsender.php on line 85

Warning: fopen(home/******/public_html/dbsender/******-092503-0628am_sql.tar.gz): failed to open stream: No such file or directory in /home/******/public_html/dbsender/dbsender.php on line 91

Warning: filesize(): Stat failed for home/******/public_html/dbsender/******-092503-0628am_sql.tar.gz (errno=2 - No such file or directory) in /home/******/public_html/dbsender/dbsender.php on line 92

Warning: fread(): supplied argument is not a valid stream resource in /home/******/public_html/dbsender/dbsender.php on line 92

Warning: fclose(): supplied argument is not a valid stream resource in /home/******/public_html/dbsender/dbsender.php on line 93

Database backup created and sent! File name home/******/public_html/dbsender/******-092503-0628am_sql.tar.gz


I've no idea what I'm doing wrong ! The file appears in the directory but the file that is sent 2 my email is empty ! Oh Crap I didn't back up my sql table before doing this will it screw it up ?

#18 User is offline   surefire 

  • Immediate Family
  • PipPipPipPip
  • Group: Members
  • Posts: 1,011
  • Joined: 09-May 03

Posted 25 September 2003 - 09:35 AM

I think that the errors indicate that the setup variables aren't correct. I think you already knew that.

I would guess that you probably put the $dbname (name of your database) incorrectly. Or you forgot to assign the user to the database.

It took a bit of tweaking on my part to get the script running correctly. The way I solved it was to open an ftp connection to my site and see that the script was sucessfully uploading a file. I saw where the file was being put (not where I wanted) and went back into the script to find out why.

A little tip... if you are emailing the file to yourself, then you don't need to ftp the file to your site. It's redundant... and you'll still have a file on your site if you set up the vars correctly.

Also, I noticed that you put the script in the public_html folder... you should strongly consider moving it outside the public_html directory. Put it in your home folder.

#19 User is offline   arvind 

  • Immediate Family
  • PipPipPipPip
  • Group: Members
  • Posts: 482
  • Joined: 21-August 03

Posted 25 September 2003 - 10:53 AM

rite i've removed it from my public_html folder but now that its in the home folder how do i run it to make sure it works ?

#20 User is offline   surefire 

  • Immediate Family
  • PipPipPipPip
  • Group: Members
  • Posts: 1,011
  • Joined: 09-May 03

Posted 25 September 2003 - 12:40 PM

Set up a cron job. This could be tricky if you've never done it before. There is info in this thread and others on the forum that explain it. For testing, you might want to set up to execute every five minutes or so, as long as your database isn't too huge.

#21 User is offline   kellybellydotnet 

  • Family Friend
  • PipPip
  • Group: Members
  • Posts: 92
  • Joined: 07-December 02

Posted 26 September 2003 - 07:31 PM

Quote

Directions.

1- Cpanel
2- phpMyAdmin
3- Click on your database (not the tables, the actual database link above your tables)
4- in the main window, click Export
5- Choose 'Structure and Data', 'Save as File' and any other features you want
6- submit, choose the location to download and store the textfile on your computer

Repeat as often as you like.


Okay, so I've been backing up my sites' databases like this:

1- Cpanel
2- Backup
3- Click on the database name(s) under Download a SQL DB Backup (shouldn't this be an SQL?)
4- Save the file to my harddrive

Is this doing the same thing?

#22 User is offline   surefire 

  • Immediate Family
  • PipPipPipPip
  • Group: Members
  • Posts: 1,011
  • Joined: 09-May 03

Posted 28 September 2003 - 11:30 AM

Yes... this script just does it automatically.

#23 User is offline   LaMpiR 

  • Group: Members
  • Posts: 1
  • Joined: 15-July 05

Posted 15 July 2005 - 07:32 AM

I've downloaded it but i don't have ssh acccess to my hosting so i've uploaded it to /httpdocs as dbsender.php and chmoded it to 770.
I have also modified line 67 as someone has mention it before.
I have plesk 7.5.3 and i've added this to my crontab

Quote

* 12 * * * php -q /httpdocs/dbsender.php
I beleive that this command should be executed every 12 hours?
It was setted for every 5 minutes i have waited for half hour but nothing happened.
This is how my config looks like

Quote

// Optional Options You May Optionally Configure

$use_gzip = "yes";  // Set to No if you don't want the files sent in .gz format
$remove_sql_file = "yes"; // Set this to yes if you want to remove the .sql file after gzipping. Yes is recommended.
$remove_gzip_file = "no"; // Set this to yes if you want to delete the gzip file also. I recommend leaving it to "no"

// Configure the path that this script resides on your server.

$savepath = "/httpdocs/backup"; // Full path to this directory. Do not use trailing slash!

$send_email = "yes";  // Do you want this database backup sent to your email? Fill out the next 2 lines
$to      = "lampir@gmail.com";  // Who to send the emails to
$from    = "backup@yumirc.net"; // Who should the emails be sent from?

$senddate = date("j F Y");

$subject = "MySQL Database Backup - $senddate"; // Subject in the email to be sent.
$message = "Your MySQL database has been backed up and is attached to this email"; // Brief Message.


$use_ftp = "no"; // Do you want this database backup uploaded to an ftp server? Fill out the next 4 lines
$ftp_server = "localhost"; // FTP hostname
$ftp_user_name = "ftp_username"; // FTP username
$ftp_user_pass = "ftp_password"; // FTP password
$ftp_path = "/"; // This is the path to upload on your ftp server!

Does anyone have any ides why it doesn't work ?

p.s. i just saw date of the last post :)

This post has been edited by LaMpiR: 15 July 2005 - 07:33 AM


#24 User is offline   TCH-Bruce 

  • Lead Forum Moderator
  • PipPipPipPip
  • Group: Admins
  • Posts: 22,031
  • Joined: 11-August 03

Posted 15 July 2005 - 07:45 AM

Welcome to the forum LaMpiR :)

Depends on your server if it is configured to run PHP scripts with permissions set to 770. You may have to set them to 777.

Does the /httpdocs/backup folder exist? Does it have write permissions?

I beleive the path should be the FULL path to your backup folder. Something like /home/username/httpdocs/backup
Bruce Richards
Lead Forum Moderator
TotalChoice Hosting, L.L.C.
Webhosting by Total Choice Web Hosting - General Support Forum

I am the Lead Forum Moderator. While I can assist in answering most of your hosting related questions, I am unable to answer questions about specifics relating to your account such as billing and server related issues. Should you need assistance in these areas, please contact our Help Desk or our many other options. Another good place to find answers is with our help pages, tutorials and movie tutorials.

#25 User is offline   TCH-Rob 

  • Help Desk Manager
  • PipPipPipPip
  • Group: Members
  • Posts: 7,818
  • Joined: 11-March 03

Posted 15 July 2005 - 07:57 AM

Welcome to the forum LaMpiR

#26 User is offline   TweezerMan 

  • Immediate Family
  • PipPipPipPip
  • Group: Members
  • Posts: 1,767
  • Joined: 26-September 04

Posted 15 July 2005 - 08:06 AM

Welcome to the forums, LaMpiR! :thumbup1:

LaMpiR, on Jul 15 2005, 05:32 AM, said:

I have plesk 7.5.3 and i've added this to my crontab

Quote

* 12 * * * php -q /httpdocs/dbsender.php

I beleive that this command should be executed every 12 hours?
It was setted for every 5 minutes i have waited for half hour but nothing happened.
<{POST_SNAPBACK}>

That crontab is set to run at 12:00PM (local server time), not every 12 hours. And since the minutes part of the crontab is "*" (the first "*" before the '12'), it will run once every minute between 12:00PM and 12:59PM.

TCH-Bruce, on Jul 15 2005, 05:45 AM, said:

Depends on your server if it is configured to run PHP scripts with permissions set to 770.  You may have to set them to 777.
<{POST_SNAPBACK}>

Since the script is being run from a cron job, it should be running under the user's ID and 0700 file permissions should be more than sufficient.

TCH-Bruce, on Jul 15 2005, 05:45 AM, said:

I believe the path should be the FULL path to your backup folder. Something like /home/username/httpdocs/backup
<{POST_SNAPBACK}>

I'm with TCH-Bruce on this one! :yes:
David Phillips (TweezerMan)
The Tweezer's Edge v3

#27 User is online   TCH-Thomas 

  • Volunteer Moderator
  • PipPipPipPip
  • Group: Moderators
  • Posts: 15,805
  • Joined: 01-May 03

Posted 15 July 2005 - 08:06 AM

Welcome to the forum, LaMpiR. :)
Thomas Jikrantz
Forum Moderator
TotalChoice Hosting, L.L.C.

Any links or suggestions for third party software/sites should be used at your own risk. My opinions and recommendations are not necessary those of TCH and TCH is not responsible.

As a Forum Moderator I can assist in answering many of your hosting related questions. However, I am unable to answer questions about specifics relating to your account such as billing and server related issues. Should you need assistance in these areas, please contact our Help Desk or our many other options. Another good place to find answers is with our help pages, tutorials and movie tutorials.

Web Hosting by Total Choice Web Hosting - 24/7 Help Desk

#28 User is offline   TCH-Bruce 

  • Lead Forum Moderator
  • PipPipPipPip
  • Group: Admins
  • Posts: 22,031
  • Joined: 11-August 03

Posted 15 July 2005 - 10:59 AM

TCH-David, on Jul 15 2005, 09:06 AM, said:

Since the script is being run from a cron job, it should be running under the user's ID and 0700 file permissions should be more than sufficient.

I was just going by the contents of the dbsender script itself. Thanks for the assist David. :thumbup1:
Bruce Richards
Lead Forum Moderator
TotalChoice Hosting, L.L.C.
Webhosting by Total Choice Web Hosting - General Support Forum

I am the Lead Forum Moderator. While I can assist in answering most of your hosting related questions, I am unable to answer questions about specifics relating to your account such as billing and server related issues. Should you need assistance in these areas, please contact our Help Desk or our many other options. Another good place to find answers is with our help pages, tutorials and movie tutorials.

#29 User is offline   stevevan 

  • Immediate Family
  • PipPipPipPip
  • Group: Members
  • Posts: 3,537
  • Joined: 26-April 03

Posted 15 July 2005 - 01:37 PM

Welcome to the forums. Hope you were able to get your problem solved!
Steve, W4SJV

"When all else fails (and it will)...there's Amateur Radio!"
"It is better to let people THINK you're a fool than to open your mouth and remove all doubt."

#30 User is offline   TCH-Don 

  • Volunteer Moderator
  • PipPipPipPip
  • Group: Moderators
  • Posts: 11,679
  • Joined: 30-November 02

Posted 15 July 2005 - 01:47 PM

Welcome to the forums, LaMpiR :D
Don Rosenquist
Forum Moderator
TotalChoice Hosting, L.L.C.
Web Hosting by Total Choice Web Hosting - For Your Family - Web Hosting Family!

Any links or suggestions for third party software/sites should be used at your own risk.
My opinions and recommendations are not necessarily those of TCH and TCH is not responsible.

I am a Forum Moderator and a volunteer. While I can assist in answering most of your hosting related questions, I am unable to answer questions about specifics relating to your account such as billing and server related questions. Should you need assistance in these areas, please contact our Help Desk.


treasure your pets

The Turtle says "A little knowledge is a dangerous thing,
so keep learning!"

#31 User is offline   DPK 

  • Family Friend
  • PipPip
  • Group: Members
  • Posts: 59
  • Joined: 12-October 05

Posted 22 October 2005 - 09:19 PM

Hey all,

I guess we can attempt to keep this going.
I installed this script, with my mods, into a new folder, under the root, same level as the public_html directory, called backup.

When it is executing I keep getting an e-mail saying "No input file specified." My execution script on the CPANEL 'standard cron manager' is: php -q /backup/dbsender.php

Any thoughts?

Also, can I change the chmod via CPANEL? My current FTP does not allow me to.

#32 User is offline   DPK 

  • Family Friend
  • PipPip
  • Group: Members
  • Posts: 59
  • Joined: 12-October 05

Posted 22 October 2005 - 11:40 PM

Figured out the CHMOD issue, CPANEL, File manager, Click on folder name, change permissions.

#33 User is offline   cajunman4life 

  • Immediate Family
  • PipPipPipPip
  • Group: Members
  • Posts: 1,144
  • Joined: 06-October 04

Posted 22 October 2005 - 11:44 PM

Also, as a side-bar... In the original post it recommended to do a dump through phpMyAdmin... something easier for those that are new to this would be in the backup section of cpanel. You should see a link for each of the SQL databases you have in your account. Clicking the link will download a gzipped version of the SQL dump.
Aaron J. Graves

#34 User is offline   DPK 

  • Family Friend
  • PipPip
  • Group: Members
  • Posts: 59
  • Joined: 12-October 05

Posted 23 October 2005 - 12:28 AM

Glad to have this forum, all is working well. I like this script, even gives you the recovery SQL if needed.

Thx,

DPK

#35 User is offline   TweezerMan 

  • Immediate Family
  • PipPipPipPip
  • Group: Members
  • Posts: 1,767
  • Joined: 26-September 04

Posted 23 October 2005 - 04:27 AM

View PostDPK, on Oct 22 2005, 07:19 PM, said:

When it is executing I keep getting an e-mail saying "No input file specified." My execution script on the CPANEL 'standard cron manager' is: php -q /backup/dbsender.php

The path to the file name should start with '/home/cpanelName' (where cpanelName is the username you use to log into your CPanel). The '/home/cpanelName' directory is the top most directory that you can view in your account (via FTP or CPanel's File Manager). Your web site's 'public_html' directory is actually '/home/cpanelName/public_html'.
David Phillips (TweezerMan)
The Tweezer's Edge v3

#36 User is offline   mriffey 

  • New To The Neighborhood
  • Pip
  • Group: Members
  • Posts: 18
  • Joined: 06-April 04

Posted 25 October 2005 - 02:39 AM

Do some TCH servers support ncftp? Mine doesnt appear to.

I ask cuz the current version of this script refers to NCFTP, rather than using stock php FTP syntax.

Mark

#37 User is offline   TweezerMan 

  • Immediate Family
  • PipPipPipPip
  • Group: Members
  • Posts: 1,767
  • Joined: 26-September 04

Posted 25 October 2005 - 09:40 AM

I believe the server would need to be running an NcFTPd FTP server in order to use NcFTP commands. As far as I know, TCH servers run ProFTPd for the FTP server.
David Phillips (TweezerMan)
The Tweezer's Edge v3

#38 User is offline   rbrown3rd 

  • Group: Members
  • Posts: 1
  • Joined: 11-January 06

Posted 11 January 2006 - 05:46 PM

View PostTCH-David, on Oct 25 2005, 09:40 AM, said:

I believe the server would need to be running an NcFTPd FTP server in order to use NcFTP commands. As far as I know, TCH servers run ProFTPd for the FTP server.

How hard would it be to modify the script so that it would work with a hosting service that has not installed anything beyond the basic ftp function? Oh, this thread has been really helpful. I have the email backup function working by means of a crontab but since my hosting service, another one that will go unamed, does not have NcFTP or ProFTPd how can the script be modified to work?

Thanks to all for some very helpful comments and information.

Bob 3

#39 User is offline   ashesnglass 

  • Family Friend
  • PipPip
  • Group: Members
  • Posts: 33
  • Joined: 22-January 04

Posted 27 October 2006 - 11:59 AM

This is a great script, but I'm running into a problem.

When I run the script, it creates the backups in the directory where the script is located. However, it will neither e-mail the backups nor upload them to FTP. I even set the permissions everywhere to 777. It's only in public_html for testing purposes.

Quote

// Optional Options You May Optionally Configure

$use_gzip = "yes"; // Set to No if you don't want the files sent in .gz format
$remove_sql_file = "yes"; // Set this to yes if you want to remove the .sql file after gzipping. Yes is recommended.
$remove_gzip_file = "no"; // Set this to yes if you want to delete the gzip file also. I recommend leaving it to "no"

// Configure the path that this script resides on your server.

$savepath = "/home/cpanelname/public_html/dbbackup"; // Full path to this directory. Do not use trailing slash!

$send_email = "yes"; // Do you want this database backup sent to your email? Fill out the next 2 lines
$to = "dave{at for TCH board purposes}yourdomain"; // Who to send the emails to
$from = "backup@yourdomain"; // Who should the emails be sent from?

$senddate = date("n/J/Y");

$subject = "RatDog.Org MySQL Backup - $senddate"; // Subject in the email to be sent.
$message = "Attached..."; // Brief Message.


$use_ftp = "yes"; // Do you want this database backup uploaded to an ftp server? Fill out the next 4 lines
$ftp_server = "domainname"; // FTP hostname
$ftp_user_name = "{TCH username}"; // FTP username
$ftp_user_pass = "{TCH password}"; // FTP password
$ftp_path = "/path/"; // This is the path to upload on your ftp server!


Any ideas? Thanks!

EDIT: TCH-Bruce - removed user sensitive data

#40 User is offline   TCH-Bruce 

  • Lead Forum Moderator
  • PipPipPipPip
  • Group: Admins
  • Posts: 22,031
  • Joined: 11-August 03

Posted 27 October 2006 - 12:24 PM

I never tried the FTP function but I do know the email function works.

You can PM your script to me and I'll take a look at it for you.
Bruce Richards
Lead Forum Moderator
TotalChoice Hosting, L.L.C.
Webhosting by Total Choice Web Hosting - General Support Forum

I am the Lead Forum Moderator. While I can assist in answering most of your hosting related questions, I am unable to answer questions about specifics relating to your account such as billing and server related issues. Should you need assistance in these areas, please contact our Help Desk or our many other options. Another good place to find answers is with our help pages, tutorials and movie tutorials.

#41 User is offline   secretal 

  • Group: Members
  • Posts: 4
  • Joined: 27-October 06

Posted 28 October 2006 - 08:42 AM

View Postashesnglass, on Oct 27 2006, 12:59 PM, said:

This is a great script, but I'm running into a problem.

When I run the script, it creates the backups in the directory where the script is located. However, it will neither e-mail the backups nor upload them to FTP. I even set the permissions everywhere to 777. It's only in public_html for testing purposes.
Any ideas? Thanks!

EDIT: TCH-Bruce - removed user sensitive data


Please update this thread if you get FTP to work.

#42 User is offline   TCH-Bruce 

  • Lead Forum Moderator
  • PipPipPipPip
  • Group: Admins
  • Posts: 22,031
  • Joined: 11-August 03

Posted 28 October 2006 - 08:54 AM

Welcome to the forums secretal :)

If I get some time this weekend I will play with it.
Bruce Richards
Lead Forum Moderator
TotalChoice Hosting, L.L.C.
Webhosting by Total Choice Web Hosting - General Support Forum

I am the Lead Forum Moderator. While I can assist in answering most of your hosting related questions, I am unable to answer questions about specifics relating to your account such as billing and server related issues. Should you need assistance in these areas, please contact our Help Desk or our many other options. Another good place to find answers is with our help pages, tutorials and movie tutorials.

#43 User is online   TCH-Thomas 

  • Volunteer Moderator
  • PipPipPipPip
  • Group: Moderators
  • Posts: 15,805
  • Joined: 01-May 03

Posted 28 October 2006 - 08:55 AM

Welcome to the forum, secretal. :)
Thomas Jikrantz
Forum Moderator
TotalChoice Hosting, L.L.C.

Any links or suggestions for third party software/sites should be used at your own risk. My opinions and recommendations are not necessary those of TCH and TCH is not responsible.

As a Forum Moderator I can assist in answering many of your hosting related questions. However, I am unable to answer questions about specifics relating to your account such as billing and server related issues. Should you need assistance in these areas, please contact our Help Desk or our many other options. Another good place to find answers is with our help pages, tutorials and movie tutorials.

Web Hosting by Total Choice Web Hosting - 24/7 Help Desk

#44 User is offline   secretal 

  • Group: Members
  • Posts: 4
  • Joined: 27-October 06

Posted 28 October 2006 - 09:04 AM

Thanks for the welcome...I'm looking forward to being able to automate FTP.

#45 User is offline   TCH-Don 

  • Volunteer Moderator
  • PipPipPipPip
  • Group: Moderators
  • Posts: 11,679
  • Joined: 30-November 02

Posted 28 October 2006 - 09:06 AM

Another option that some of us use is AutoMySQLBackup from SourceForge.
I get an email every morning of my databases.
There is an option for automatically selecting all databases
# List of DBNAMES for Daily/Weekly Backup e.g. "DB1 DB2 DB3"
DBNAMES="all"

So you are covered when you add a new database.
Don Rosenquist
Forum Moderator
TotalChoice Hosting, L.L.C.
Web Hosting by Total Choice Web Hosting - For Your Family - Web Hosting Family!

Any links or suggestions for third party software/sites should be used at your own risk.
My opinions and recommendations are not necessarily those of TCH and TCH is not responsible.

I am a Forum Moderator and a volunteer. While I can assist in answering most of your hosting related questions, I am unable to answer questions about specifics relating to your account such as billing and server related questions. Should you need assistance in these areas, please contact our Help Desk.


treasure your pets

The Turtle says "A little knowledge is a dangerous thing,
so keep learning!"

#46 User is offline   TCH-Bruce 

  • Lead Forum Moderator
  • PipPipPipPip
  • Group: Admins
  • Posts: 22,031
  • Joined: 11-August 03

Posted 29 October 2006 - 10:54 AM

I have tried setting up the FTP part of the script. Unfortunately ncftpput is not supported on the server I am on or any of the others I would imagine.

I don't know if the one Don links to above allows you to FTP or not.

I set up a special email address to send the backups to that I make and it works well for me.
Bruce Richards
Lead Forum Moderator
TotalChoice Hosting, L.L.C.
Webhosting by Total Choice Web Hosting - General Support Forum

I am the Lead Forum Moderator. While I can assist in answering most of your hosting related questions, I am unable to answer questions about specifics relating to your account such as billing and server related issues. Should you need assistance in these areas, please contact our Help Desk or our many other options. Another good place to find answers is with our help pages, tutorials and movie tutorials.

#47 User is offline   secretal 

  • Group: Members
  • Posts: 4
  • Joined: 27-October 06

Posted 29 October 2006 - 11:23 AM

View PostTCH-Bruce, on Oct 29 2006, 10:54 AM, said:

I have tried setting up the FTP part of the script. Unfortunately ncftpput is not supported on the server I am on or any of the others I would imagine.

I don't know if the one Don links to above allows you to FTP or not.

I set up a special email address to send the backups to that I make and it works well for me.


Thanks for the followup. I assume you mean the other script recommended by Don is the one you got working with email. I'll have to give it a try. Email will be sufficient for now.

I'm researching using a different method to FTP...I'm no script expert so my effort may take a while. :)

#48 User is offline   secretal 

  • Group: Members
  • Posts: 4
  • Joined: 27-October 06

Posted 29 October 2006 - 01:05 PM

I've tried both scripts and the mail feature doesn't work for me with either one. Maybe the mail feature is disabled on server125.

#49 User is offline   TCH-Bruce 

  • Lead Forum Moderator
  • PipPipPipPip
  • Group: Admins
  • Posts: 22,031
  • Joined: 11-August 03

Posted 29 October 2006 - 02:28 PM

Should not be having an issue with email. Please open a ticket with the help desk and ask if they would take a look.
Bruce Richards
Lead Forum Moderator
TotalChoice Hosting, L.L.C.
Webhosting by Total Choice Web Hosting - General Support Forum

I am the Lead Forum Moderator. While I can assist in answering most of your hosting related questions, I am unable to answer questions about specifics relating to your account such as billing and server related issues. Should you need assistance in these areas, please contact our Help Desk or our many other options. Another good place to find answers is with our help pages, tutorials and movie tutorials.

#50 User is offline   jhollin1138 

  • Distant Family
  • PipPipPip
  • Group: Members
  • Posts: 143
  • Joined: 05-August 04

Posted 29 October 2006 - 08:01 PM

View PostTCH-Bruce, on Oct 29 2006, 10:54 AM, said:

I have tried setting up the FTP part of the script. Unfortunately ncftpput is not supported on the server I am on or any of the others I would imagine.

I don't know if the one Don links to above allows you to FTP or not.

I set up a special email address to send the backups to that I make and it works well for me.

I just stumbled across this thread. Did you try using FTP functions built into php?
Jim H

#51 User is offline   TCH-Bruce 

  • Lead Forum Moderator
  • PipPipPipPip
  • Group: Admins
  • Posts: 22,031
  • Joined: 11-August 03

Posted 29 October 2006 - 08:03 PM

Hi Jim, I am not the author of the script and I didn't try modifying it to make it work. I'm sure someone could modify it to do so if they were so inclined.
Bruce Richards
Lead Forum Moderator
TotalChoice Hosting, L.L.C.
Webhosting by Total Choice Web Hosting - General Support Forum

I am the Lead Forum Moderator. While I can assist in answering most of your hosting related questions, I am unable to answer questions about specifics relating to your account such as billing and server related issues. Should you need assistance in these areas, please contact our Help Desk or our many other options. Another good place to find answers is with our help pages, tutorials and movie tutorials.

#52 User is offline   TCH-Don 

  • Volunteer Moderator
  • PipPipPipPip
  • Group: Moderators
  • Posts: 11,679
  • Joined: 30-November 02

Posted 30 October 2006 - 09:04 AM

View Postsecretal, on Oct 29 2006, 01:05 PM, said:

I've tried both scripts and the mail feature doesn't work for me with either one. Maybe the mail feature is disabled on server125.

I have been useing AutoMySQLBackup for a long time and no problems.

Double check your setting and the permissions for the script
I have 755 and it is above public_html

make sure the mailsetup is set to files
# Mail setup
MAILCONTENT="files"

Don Rosenquist
Forum Moderator
TotalChoice Hosting, L.L.C.
Web Hosting by Total Choice Web Hosting - For Your Family - Web Hosting Family!

Any links or suggestions for third party software/sites should be used at your own risk.
My opinions and recommendations are not necessarily those of TCH and TCH is not responsible.

I am a Forum Moderator and a volunteer. While I can assist in answering most of your hosting related questions, I am unable to answer questions about specifics relating to your account such as billing and server related questions. Should you need assistance in these areas, please contact our Help Desk.


treasure your pets

The Turtle says "A little knowledge is a dangerous thing,
so keep learning!"

#53 User is offline   jhollin1138 

  • Distant Family
  • PipPipPip
  • Group: Members
  • Posts: 143
  • Joined: 05-August 04

Posted 30 October 2006 - 11:48 AM

View PostTCH-Bruce, on Oct 29 2006, 08:03 PM, said:

Hi Jim, I am not the author of the script and I didn't try modifying it to make it work. I'm sure someone could modify it to do so if they were so inclined.

It shouldn't be hard to do. I will see if I have some time this evening.
Jim H

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users