Another auto-backup script 🙂
This time, I wanted to have a quick and easy way to login to my server from my windows laptop, compress and backup the wordpress blog content, as well as the wordpress mysql database, then copy everything back to my laptop. A one-click backup basically.
Here’s what I did. First up, you need to download pscp and plink. I mentioned pscp in previous backup scripting posts. Both program are part of the “putty family”. Plink is basically a CLI version of putty, and pscp is a secure copy program (transfers files over ssh).
So the next step is instructing my laptop to login to the server and run a series of commands. We do this via plink:
plink firstname.lastname@example.org -pw really_good_pass -P 22 -m wordpressback.txt
The above uses plink to connect to 192.168.100.36 on port 22 (SSH) using username user and pasword “really_good_pass”. Once connected, the -m switch instructs plink to run the commands in wordpressback.txt. In this file, we list the commands that should be run on the server: