0

I want to backup my whole linux server but where do i --exclude=proc --exclude=sys --exclude=dev/pts --exclude=/var/backups . Please help!!!

Here is my code. I may also have some errors in it. Feedback is welcome.....

#!bin/bash
#Purpose = Backup of var directory

TIME=`date +"%b-%d-%y"`  # This Command will add date in Backup File Name.
FILENAME="backup-$TIME.tar.gz"  # Here i define Backup file name format.
SRCDIR="/ "    # Location of Important Data Directory (Source of backup).
DESDIR="/var/backups/fullbackup"    # Destination of backup file.
LOGSYS="/var/log/fullbackup"   #Log files of the backup.

echo "Starting backup of $SRCDIR to $DESDIR on $TIME" >> ${LOGSYS}
tar -cpzf $DESDIR/$FILENAME $SRCDIR
echo "Ending backup of $SRCDIR on $TIME" >> ${LOGSYS}

#END 
Tunaki
  • 132,869
  • 46
  • 340
  • 423
user3652178
  • 3
  • 1
  • 3
  • 1
    possible duplicate of [excluding some folders in tar command not work](http://stackoverflow.com/questions/8020690/excluding-some-folders-in-tar-command-not-work) – martin Aug 14 '14 at 11:33
  • The line with tar in it makes a backup of all mine directory's of root (everything included) if i'am not mistaken but i want to exclude some directory's. – user3652178 Aug 14 '14 at 11:33
  • Then add the `--exclude` parameters to your `tar` call. – scai Aug 14 '14 at 11:45
  • so after the $SRCDIR --exclude=proc --exclude=sys? @scai – user3652178 Aug 14 '14 at 11:50
  • The position doesn't matter, except not between parameter `f` and the file name of the archive. – scai Aug 14 '14 at 15:32
  • possible duplicate of [Shell command to tar directory excluding certain files/folders](http://stackoverflow.com/questions/984204/shell-command-to-tar-directory-excluding-certain-files-folders) – mc110 Aug 14 '14 at 16:00

0 Answers0