Main

Projects

Articles

Thanos K - aka DJ Art

a humble webspace about linux and technology

system-backup

Bash script for backups using Tar

#!/bin/bash PWD=`pwd` backupname=linuxbackup-$(date +%Y%m%d) workingdir=/usr/local/src #put below the directories you want to be backed up sourcedirs="/boot /etc /home/backup /home/djart /home/ftp /home/httpd /root /var /usr/local/etc /usr/local/games/scummvm-saves" if [ -s $workingdir/$backupname.tar.bz2 ] ; then echo $workingdir/$backupname.tar.bz2 exists. Exiting now! exit 0 fi echo Creating bzip2 tarball ... tar cfj $workingdir/$backupname.tar.bz2 $sourcedirs echo Done! exit 0