Difference between revisions of "BBB Backup your work"
From Klaus' wiki
Line 31: | Line 31: | ||
echo "Backing up ${HOMESRC}" | echo "Backing up ${HOMESRC}" | ||
− | ssh ${USERNAME}@${HOST} "tar zcpf - ${HOMESRC}" |cat - > ${HOMETAR}.${SUFFIX} | + | ssh ${USERNAME}@${HOST} "tar zcpf - ${HOMESRC}" |cat - > ${HOMETAR}.${SUFFIX} |
echo "Backing up ${ROOTSRC}" | echo "Backing up ${ROOTSRC}" | ||
− | ssh ${USERNAME}@${HOST} "tar zcpf - ${ROOTSRC}" |cat - > ${ROOTTAR}.${SUFFIX} | + | ssh ${USERNAME}@${HOST} "tar zcpf - ${ROOTSRC}" |cat - > ${ROOTTAR}.${SUFFIX} |
echo "Backing up ${ETCSRC}" | echo "Backing up ${ETCSRC}" | ||
− | ssh ${USERNAME}@${HOST} "tar zcpf - ${ETCSRC}" |cat - > ${ETCTAR}.${SUFFIX} | + | ssh ${USERNAME}@${HOST} "tar zcpf - ${ETCSRC}" |cat - > ${ETCTAR}.${SUFFIX} |
</source> | </source> | ||
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. | 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. |
Latest revision as of 16:48, 24 November 2016
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!
#!/bin/bash # # # 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. # HOMESRC="/home/klaus" HOMETAR="BBB-home-backup.tgz" ROOTSRC="/root" ROOTTAR="BBB-root-backup.tgz" ETCSRC="/etc" ETCTAR="BBB-etc-backup.tgz" USERNAME="root" HOST="192.168.7.2" 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.