bak v1.02 — my linux profile backup script


This is the little script I wrote to backup my linux profile. No, it won’t work for you. But you can make it work, I suppose. How? I have no idea, sorry. The standard disclaimer applies here: it works fine on my system. So there! 🙂

#+---------------------------------------------------------------------+
#| bak - Backup current linux profile to external storage (personal) |
#| v1.02 |
#| 2006-09-21 |
#| |
#| history: |
#| 0.01 - first working prototype |
#| 1.00 - initial release (hardcoded user, dynamic dating filename) |
#| 1.01 - dynamic username (current using `id -un`) |
#| 1.02 - $HOME usage in copy for simplification |
#+---------------------------------------------------------------------+
clear
echo -e "033[1mBacking up to `id -un``date +%Y%m%d`033[0m______033[1m.tar.bz2!033[0m"
#+---------------------------------------------------------------------+
#| Use root privileges to back up linux profile in home folder |
#| (delete older daily backups for today's date and add current backup)|
#+---------------------------------------------------------------------+
su -l root -c 'cd /home; rm -f '`id -un`'`date +%Y%m%d`*.tar.bz2; tar cpjf '`id -un`'`date +%Y%m%d%H%M%S`.tar.bz2 '`id -un`
echo
echo -e '033[1m[/home]033[0m'
ls -hl --color=tty /home
echo
#+---------------------------------------------------------------------+
#| On external storage, delete all daily backups for today's date |
#+---------------------------------------------------------------------+
rm -f /media/SEA_DISC/Backups/Linux/`id -un``date +%Y%m%d`*.tar.bz2
#+---------------------------------------------------------------------+
#| copy most current daily backup from profile area to external storage|
#+---------------------------------------------------------------------+
cp -au `echo $HOME``date +%Y%m%d`*.tar.bz2 /media/SEA_DISC/Backups/Linux
echo -e '033[1m[/media/SEA_DISC/Backups/Linux]033[0m'
ls -hl --color=tty /media/SEA_DISC/Backups/Linux
echo

Advertisements