#!/bin/sh # Osamu's simple backup script for home Linux user. (Version 2.1) # License: GPL 2.0 or later. # Depends: afio (ras) gzip cdrecord mkisofs sudo (Gnome) # Author: Osamu Aoki # Execute this command from a writable directory where backups are kept. # I recommend this to be different partition. # # You may ocasionarry back up these to different media. # Since gnome is easy, use Nautilus CD Creator which support CD and DVD. # # These are still very alpha stage script. Use this only as an example. # Use at your own risk and read script and its comment in advance. DATE=$(date --utc +"%Y%m%d-%H%M") [ -d /var/backups ] || mkdir -p /var/backups # Make package selection backed up sudo dpkg --get-selections \* >/var/backups/dpkg-selections.list # use dpkg --set-selection command for recovery. # Following debconf backup is untested. (from #sudo debconf-get-selections > /var/backups/debconf-selections # Use debconf-set-selections for recovery. # define files to back up and feed their names to the stdin of afiocd sudo find /etc /home /var/lib/dpkg /var/backups /var/lib/cvs \ -xdev \ -path '*/Cache' -prune -o \ -path '*/Mail' -prune -o \ -path '*/public_html' -prune -o \ -print0 | afio BU$DATE.afio # Above are meant to be customized to fits your needs. # # - If you run server such as mail or CVS, you should have # important data to back up in other parts of /var directory. # - I found SSH server key needs to be backed up too. sudo touch /last-backup.stamp # You may edit above to do incremental backup. # use touch to create a file after back up # use "-cnewer /last-backup.stamp" to narrow down back up. # If you want to make this to write to multiple cds, with data redundancy, # place "afiocd" instead of "afio BU$DATE.afio" and put "afiocd" script in your command # path as executable. "afiocd" is also located in Debian Reference examples. # "afiocd" is a generic part of cd backup script. # Now that DVD are cheap, simple afio as above is better than complicated # multi CD backup. My backup is about 1 GB. # If you want to use remore machine to archive your back up, please edit this # command file to copy securely over network using SCP or use the pipe # with remote shell command SSH. # If you want to backup system regulary, please consider running this # from CRON job. (See 8.6.27) # For backing up debconf information # Keep it simple!