Results 1 to 4 of 4
Hybrid View
-
12th May 2012, 04:16 PM #1Member
yeah i am using similar script but a simpler one using only few lines
http://www.besthostingforums.com/48-...sh-script.htmlmasterbator Reviewed by masterbator on . Anybody knows a good script to backup files and db and upload to remote ftp? I?m searching for a script that backups mysql database and files of a folder and upload them to my remote server using ftp. With this solution i want to have a daily backup at another server, which i can restore very fast if my main VPS goes down. At the moment i found this: http://www.cyberciti.biz/tips/how-to-backup-mysql-databases-web-server-files-to-a-ftp-server-automatically.html I still have to test it, if you know any other good alternative reply with it. Thanks in advance. Rating: 5
-
12th May 2012, 07:30 PM #2OPMemberWebsite's:
bypassx.comThanks masterbator, something simple twice better
It can be improved backuping files too.
---------- Post added at 07:30 PM ---------- Previous post was at 04:31 PM ----------
Well... i modified the code provided by masterbator to adjust to my needs and correct some issues on my CentOS 5 x64 machine, fixes:
- Tar shows a warning for use absolute paths (the files are compressed Ok anyway, but i not love see warning messages so i decied to fix them).
- Changed ".tgz" extension of compressed files to ".tar.gz", both are equivalent, correct and working extensions but i always used ".tar.gz" and not give problems unless you go to a very very very old OS that not allows more than one point and more than three letters into a extension (MS-DOS for example).
- Changed "-" with "_", since can cause issues have "-" char into filenames.
- Ftp client on my CentOS 5 x64 (using same code as masterbator) result in upload files corrupted to my remote server, then i changed ftp to ncftp (installed by default on my CentOS 5 x64). I?m using into remote server vsftpd as ftp server/daemon.
- I use /tmp folder as temporary folder to create backups and delete them, seems a safer location to play with command "rm -rf".
- Line "rm -rf /your/path/*" is a little hardcore for me, i used prefix namefile, wildcard "*" and file extension, less hardcore.
- Added support to backup files of my public_html folder.
- Added support to upload the compressed and uncompressed database backup (i?m paranoic, but with a safe backup in my hands).
The code (remember to edit script with your paths and user/pass, the blue text):
Code:#!/bin/bash ### Dump mysql database and compress it ### echo Starting Database Backup mysqldump -uYour_db_User -pYour_db_password -hlocalhost Your_db > /tmp/sql_backup_`date +%d%m%y`.sql cd /tmp tar -zcf sql_zipped_backup_`date +%d%m%y`.tar.gz sql_backup_*.sql echo Database Backup Completed ### Compress files ### echo Starting Files Backup cd / tar -zcf /tmp/filesbackup_`date +%d%m%y`.tar.gz home/www/web.com/public_html echo Files Backup Completed ### Upload to remote ftp ### cd /tmp HOST='100.200.200.105' USER='ftp_user' PASSWD='ftp_pass' ncftp -u"$USER" -p"$PASSWD" $HOST<<EOF put sql_zipped_backup_*.tar.gz put filesbackup_*.tar.gz put sql_backup_*.sql quit EOF ### Delete backups ### echo Start Cleaning Backup Files cd /tmp rm -rf sql_zipped_backup_*.tar.gz rm -rf sql_backup_*.sql rm -rf filesbackup_*.tar.gz echo Cleaning Backup Files Completed exit 0
Sponsored Links
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Similar Threads
-
Any way to transload files using free download option and then remote upload?
By mystaku in forum Webmaster DiscussionReplies: 0Last Post: 2nd May 2012, 12:11 PM -
[How to] STOP remote upload of my files?
By jokerit in forum File Host DiscussionReplies: 6Last Post: 10th Dec 2011, 11:22 AM -
Remote upload files from Errotica-Archives
By BrambleBramley in forum File Host DiscussionReplies: 0Last Post: 15th Aug 2011, 06:26 AM -
multiupload.com (multihosting upload files) and remote uploads too
By liberiangirl in forum File Host DiscussionReplies: 8Last Post: 9th May 2011, 06:10 PM -
How do I remote upload files from seedbox to RL
By Nithin in forum Technical Help Desk SupportReplies: 8Last Post: 7th Jan 2010, 09:00 AM
themaPoster - post to forums and...
Version 5.38 released. Open older version (or...