A Shell Script That Simplifies Remote Backup of Virtual Private Servers

Backing up your Virtual Private Servers (VPS) is a critical part of maintaining up your virtual infrastructure. However, manually logging into dozens of droplets 0can become tine consuming. This shell script creates a tar archive of your data and uses secure copy (scp) to download the archive into your computer. This script will work for Linux, FreeBSD, and Mac OS X computers as well as Windows machines using Cygwin.

You will run this shell script from your local machine. Copy and paste this text into your trusty text editor and save it as "remotebackup.sh."

Make sure that the script looks okay.

Be sure to make the shell script executable.

The basic usage of this script is as follows. You will execute the script by typing "./remotebackup.sh username ipaddress /remote/directory/to/backup nameofbackupfile."

If the script says that the backup ran successfully, then you are good to go!

You will see the file listed in the directory in which you ran the script.