Backing up Der Flounder Revisited
2021-02-13 02:06:08 Author: derflounder.wordpress.com(查看原文) 阅读量:235 收藏

Home > Backup, Linux, Raspberry Pi > Backing up Der Flounder Revisited

Backing up Der Flounder Revisited

Nine years ago, I wrote a post on how I backup this blog. Overall, the reasons I’m backing up haven’t changed:

  • I like this blog and don’t want to see it or its data disappear because of data loss.
  • WordPress.com’s free hosting doesn’t provide me with an automated backup method.

To create the backups, I make a nightly mirror using HTTrack. As time has passed and host machines were replaced, I’ve moved the backup host a few times. For the last move, I decided for budgetary reasons to move off of using Macs and onto a Raspberry Pi. For those wanting to know more, please see below the jump.

The current backup host is a Raspberry Pi 3 Model B running Raspbian Buster, which is closely based on Debian Linux.To set up an automated backup using HTTrack, I used the following procedure:

1. Installed HTTrack for Debian by running the commands below with root privileges:

apt-get update
apt-get install webhttrack

2. Creating a backup directory in the pi user’s home directory by running the following command:

mkdir -p /home/pi/derflounder_backup

2. Set up the following script as /usr/local/bin/der_flounder_backup.sh

#!/bin/bash

backupDirectoryPath="/home/pi/derflounder_backup"

/usr/bin/httrack "https://derflounder.wordpress.com/" -O "$backupDirectoryPath" "+https://derflounder.wordpress.com/*" "+https://derflounder.files.wordpress.com/*" -v

For the script itself:

  • I’m first specifying the starting point. In this case, it is https://derflounder.wordpress.com/.
  • We can specify where the mirrored data will go using the -O flag (note that $backupDirectoryPath is a path I defined earlier on in my script. In this case, the data is being stored in /home/pi/derflounder_backup.
  • The quotations where I have “+” with something are urls from which it is allowed to download, and process. If you do not specify any, it will only download from the domain you specify.
  • The “-v” flag specifies httrack to run in verbose mode.

4. Set up a cron job like the one shown below to run the backup script. In my case, I set it up in the pi user’s crontab to run nightly at 2:00 AM:

0 2 * * *  /usr/local/bin/der_flounder_backup.sh

Meanwhile, like the Macs who did this job before it, I’m also backing up the Raspberry Pi that the backup is stored on, so that I have multiple copies of the backed-up data available.


文章来源: https://derflounder.wordpress.com/2021/02/12/backing-up-der-flounder-revisited/
如有侵权请联系:admin#unsafe.sh