BBB Backup your work

From Klaus' wiki
Jump to: navigation, search

Don't cry! Backup regularly.

The script below has been developed to bakup your work on the BBB.

Create a backup directory on your Centos or other Linux machine. Create this script, you may want to call it backupBBB, and make it executable. Run it regularly!

# Backup script for the BeagleBone Black.
# Modify to suit your needs
# Author:    Klaus Kolle
# Date:      20161124
# License:   Free an Open Source - use it on your own risk.
# Requirements: Drop your ssh public key on the BBB in order to
# make the process login-free for user root.
SUFFIX=`eval date +%y%m%d%H%M`
echo "Backing up ${HOMESRC}"
ssh ${USERNAME}@${HOST} "tar zcpf - ${HOMESRC}" |cat - > ${HOMETAR}.${SUFFIX}
echo "Backing up ${ROOTSRC}"
ssh ${USERNAME}@${HOST} "tar zcpf - ${ROOTSRC}" |cat - > ${ROOTTAR}.${SUFFIX}
echo "Backing up ${ETCSRC}"
ssh ${USERNAME}@${HOST} "tar zcpf - ${ETCSRC}" |cat - > ${ETCTAR}.${SUFFIX}

You'll end up with three tar-balls for the home directory, the root users home directory and the /etc directory, where most configuration takes place. Each tar-ball is date and time stamped, so you'll be able to have several backups lying around in your backup directory.