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 at backup_path
  • It zip a dump of mysql into 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:

# delete old backup
rm -rf /backup_path/

# create new dir
mkdir /backup_path/
zip -r -q -9 “/backup_path/” ” /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/

# 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.

Do you need farther help on this topic? Contact me
Do you need Professional coder? Hire me
Looking for different WordPress plugin? Try Wishlist member

Andy is one of core WordPress WishList Member Developer. He is in love with WordPress and fun of turning new ideas to WordPress plugin or theme.

Add your comment