Results 1 to 10 of 10
-
12th Jan 2012, 01:49 PM #1OPψ(`∇?)ψ
Fully automated backup - SSH to Windows FTP
Introduction:
What we need, to make this thing working is:
root access via ssh, to our web server, where our site(s) is(are) - for this, we can use putty, for example.
Windows based system (another server or home PC)
Windows 2008, 2003, or windows XP/7/Vista
WinSCP (download link provided in manual)
We also need a basic knowledge about ssh and of course, to install a simple program like WinSCP
Manual is really simple and straight forward, with all necessary links included, it is made by n00b, for n00bs
Part 1 - Making automated backup of wordpress blog
Open shh, login, and for the sake of example, lets say you have complete root access, and your folder is:
/home/admin/
inside of that folder, there could be your wordpress website, named
/home/admin/blabla (just example)
Don't go in your "blabla" folder
create folder named backup in home/admin/ with command:
Code:mkdir backup
And make a folder, where you will keep your script, that will backup things for you
Code:mkdir scripts
Code:cd scripts
Time to make a backup script
type this into your cmd line:
Code:vi blabla.script
you are sure you did all good, if on the bottom it says INSERT
Now, you can copy this piece of script in notepad, on your home desktop, open your wp-config.php, from your wordpress website, to see necessary details, in case you don't already have them somewhere, like on the image:
and enter them properly, only bold parts are the ones you need to replace
Code:#!/bin/bash MYSQL_USERNAME=sqlusername MYSQL_PASSWORD=password MYSQL_DATABASE=sqldatabasename SITE_DIR=/home/admin/blabla BACKUP_DIR=/home/admin/backup/ BACKUP_NAME=yoursite-$(date +%Y%m%d-%H%M) TMP_DIR=/home/admin/backup/$BACKUP_NAME DB_BACKUP=yourwebsite-db.sql mkdir --parents "$TMP_DIR" || { echo "ERROR: Could not create temp directory"; exit 1; } cd "$TMP_DIR" || { echo "ERROR: Could not create temp directory"; exit 1; } mysqldump -u $MYSQL_USERNAME --password=$MYSQL_PASSWORD $MYSQL_DATABASE > "$DB_BACKUP" || { echo "ERROR: Could not backup mysql db"; exit 1; } mkdir site || { echo "ERROR: Could not create temp site directory"; exit 1; } cp -R "$SITE_DIR" site || { echo "ERROR: Could not backup web site"; exit 1; } tar czf "$BACKUP_DIR$BACKUP_NAME.tar.gz" * || { echo "ERROR: Could not create backup archive"; exit 1; } rm -rf "$TMP_DIR" || { echo "ERROR: Could not clean up temp directory"; }
Now we need to save it.
Press ESC on your keyboard.
Type:
Code::write
now we need to exit from here
Code::quit
Now we prepared a script that will backup our website, together with complete SQL database.
We need to make it more automatic
We want CRON job to run it at certain point of time, to make a backup, for example, when our site is least busy (which we previously investigated, when our website have least visitors)
to make it run on cron, type:
Code:crontab -e
If there is something already, leave it there, just add your line:
Code:15 3 * * * /home/scripts/blabla.script
This option will run our backup script at 3:15 AM server time, every day
To see more options, how to setup cron, with your own preferences, check here:
Code:http://adminschoice.com/crontab-quick-reference
Ok, now we have this semi-automated...having backup on server where website is, isn't much helpful, in case when sky is falling on you.
So, now what we need is program named WinSCP, which can be downloaded here:
Code:http://winscp.net/eng/download.php
Open WinSCP, so you can enter your FTP (sFTP) details, and save them:
Save a session as something like root@mywebsite
Login to your ftp, just to see that you typed all properly.
You can close WinSCP now.
For example, in your C: drive, create folder named websitebackup to get C:\websitebackup <--this is where we will store our website backup (dooh)
By default, WinSCP is installed in "C:\Program Files (x86)\WinSCP\"
Move in that folder, and create a text file, named backup.txt
Right click mouse in that folder, you will get popup menu, go to New, then to Text Document
Open your newly created text file and copy paste, and change if necessary:
Code:option batch on option confirm off open root@mywebsite // change this, in case you named your login profile in something different cd /home/admin/backup //also change this, in case this is not your backup folder on your web server get -delete * "c:\websitebackup\" exit
We are almost done, just to automate windows to collect our backup now.
Go to Start > All Programs > Administrative Tools > Task Sheduler
On Right menu, click on Create Basic task
New window will pop up, name it, and give it some description:
Name: WinSCP
Description: downloading backup
Click Next, and you are in new menu, since we are creating new backup each day, it would be a good idea to synchronize webserver with backup, so, go with Daily option in menu, and hit Next
Define a proper time ( take care of timezones on both servers, if you 've put crontab to run on 3:15 on webserver, make a backup 10 minutes later, adding time 3:25)
Hit Next
Leave Action on default, as Start a program
Next again
Add full path to your WinSCP executable file, for example:
"C:\Program Files (x86)\WinSCP\WinSCP.exe"
In argument field, add this piece:
/console /script=backup.txt
And in field Start in:
C:\Program Files (x86)\WinSCP\
Hit Finish (or next)
Part 3 - We're done!
And, sha-zaaam, at 3:15, your webserver will make a full backup of your wordpress blog, and at 3:25, your windows server (home PC), will start downloading your backup trough FTP (only in case power is turned on)
So, here you go...enjoy
Magic of automationcvrle77 Reviewed by cvrle77 on . Fully automated backup - SSH to Windows FTP Introduction: What we need, to make this thing working is: root access via ssh, to our web server, where our site(s) is(are) - for this, we can use putty, for example. Windows based system (another server or home PC) Windows 2008, 2003, or windows XP/7/Vista WinSCP (download link provided in manual) We also need a basic knowledge about ssh and of course, to install a simple program like WinSCP Rating: 5
-
12th Jan 2012, 01:51 PM #2Banned
Thanks for this
-
12th Jan 2012, 01:57 PM #3
-
12th Jan 2012, 01:59 PM #4mmm mmm!
Thanks for sharing.
HATERS GONNA probably bring up some valid points considering I am an ignorant little twat so far up my own ass that i blame my problems on everyone and if you criticize me you're automatically wrong.
-
12th Jan 2012, 01:59 PM #5MemberWebsite's:
Elite.SO Defendos.com Motionite.comYes you can, as long as you link back and give credits.
-
12th Jan 2012, 02:08 PM #6OPψ(`∇?)ψ
-
12th Jan 2012, 03:36 PM #7MemberWebsite's:
eih.bz pornDDL.me sexytattoochicks.tumblr.com
-
12th Jan 2012, 03:58 PM #8MemberWebsite's:
iFunMaza.comAwesome! TFS
-
12th Jan 2012, 10:58 PM #9MemberWebsite's:
csoffensive.com fagbag.me
-
13th Jan 2012, 01:35 AM #10
Sponsored Links
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Similar Threads
-
FireHacking - Fully Automated Script
By Faizann20 in forum Completed TransactionsReplies: 5Last Post: 1st Jul 2012, 02:19 AM -
Sceneflux - Fully automated DDL
By Daniel in forum Useful SitesReplies: 29Last Post: 15th Dec 2011, 08:16 AM -
Automated DB backup and FTP
By Time in forum Technical Help Desk SupportReplies: 9Last Post: 10th May 2011, 05:05 PM -
Ultimate RDP Tool v1.1 - Fully Automated! + MTN!
By l0calh0st in forum Webmaster ResourcesReplies: 36Last Post: 11th Oct 2010, 12:24 AM -
[Shared] Fully Automated Rapidleech For first time
By mRAza in forum ArchiveReplies: 80Last Post: 20th May 2010, 12:27 AM
themaCreator - create posts from...
Version 3.45 released. Open older version (or...