BBB Backup your work

From Klaus' wiki
Revision as of 16:41, 24 November 2016 by Klaus (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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 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} 2>&1 > /dev/null
echo "Backing up ${ROOTSRC}"
ssh ${USERNAME}@${HOST} "tar zcpf - ${ROOTSRC}" |cat - > ${ROOTTAR}.${SUFFIX} 2>&1 > /dev/null
echo "Backing up ${ETCSRC}"
ssh ${USERNAME}@${HOST} "tar zcpf - ${ETCSRC}" |cat - > ${ETCTAR}.${SUFFIX} 2>&1 > /dev/null

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.