Skip to main content

Thread: Ubuntu Tar Backup Script, Not Excuding a Folder


i trying create tar backup script. used following article baseline:
https://help.ubuntu.com/community/backupyoursystem/tar

, ended creating:
code:
#!/bin/bash # init  date=$(date +20%y%m%d)  sudo tar -cvpzf /tmp/`hostname`_$date.tar.gz \ --exclude=/proc \ --exclude=/lost+found \ --exclude=/sys \ --exclude=/mnt \ --exclude=/media \ --exclude=/dev \ --exclude=/tmp \ --exclude=/home/jlacroix/desktop \ --exclude=/home/jlacroix/documents \ --exclude=/home/jlacroix/music \ --exclude=/home/jlacroix/pictures \ --exclude=/home/jlacroix/projects \ --exclude=/home/jlacroix/roms \ --exclude=/home/jlacroix/videos \ --exclude="/home/jlacroix/.virtualbox vms" \ --exclude=/home/jlacroix/.spideroak \ /  scp /tmp/`hostname`_$date.tar.gz jlacroix@pluto:/share/recovery/snapshots  sudo rm /tmp/`hostname`_$date.tar.gz
the problem runs, tries backup tar backup file itself. don't understand why, since backup file lives inside /tmp. 1 of directories told exclude.

second question, if exclusion of ".virtualbox vms" folder correct. folder has space in it, wrapped in double quotes. right thing do, or should put paths in double quotes make consistent?

that looks should work. similar works me. backup file picked in error or else picked should excluded?

things can think of these.
  1. if --exclude=/tmp in script includes non-printable characters (such carriage-return etc.)
  2. if /tmp symbolic link to, example, /var/tmp backup file picked under proper name.


Forum The Ubuntu Forum Community Ubuntu Specialised Support Development & Programming Programming Talk Ubuntu Tar Backup Script, Not Excuding a Folder


Ubuntu

Comments

Popular posts from this blog

Thread: Firefox print dialog doesn't remember settings

Error 400 - Photoshop services are not available

After Effects error:creating resource file on Windows