How To, Wordpress Tips  

I am sharing my simple SSH script to backup my online server.

  • First it remove my last backup. I do not want to keep more than last backup in my server.
  • It zip all file of my website ( except excluded directories )  into  mydomainbackup.zip at backup_path
  • It zip a dump of mysql into mysqldump.zip at backup path

Now I have full backup of all files and database in my server.  Then I copy it into my local computer. If  needed I clone or sync  it in my local development website. Here is the SSH script:

clear
# delete old backup
rm -rf /backup_path/

# create new dir
mkdir /backup_path/
zip -r -q -9 “/backup_path/mydomainbackup.zip” ” /path_to_my_domain/” -x */dl/* -x */stats/* -x */logs/* -x */fg/* -x */*.kde/*

# backup mysql
mysqldump -u username -p password databasename -c |zip -9 -q > /backup_path/mysqldump.zip

clear
# finished

The way I use is, copy pasting above code into SSH terminal! Above script can be much better. but currently It do the task I needed.

I do backup end of each month. durring month I transfer modified files from local website to online website.This way may online website and local development website will be sync together.  More details  about my working environment coming soon.

  • Share/Bookmark

Add your comment





( DoFollow )

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Home | WordPress | Themes | Plugins | Download | Forum | Freelance | Resume | Projects | Service | Contact | About
Copyright 2009 Hecode.com