BashScripts.org
http://bashscripts.org/forum/

backup script (not broken and interactive)
http://bashscripts.org/forum/viewtopic.php?f=7&t=106
Page 1 of 1

Author:  jbsnake [ Tue May 31, 2005 8:52 pm ]
Post subject:  backup script (not broken and interactive)

5-31-05

Code:
#!/bin/bash

BACKUP_DIRS="/etc/
/root/
/home/
/var/log/"

EXCLUDE_BACKUP_EXT="iso
ogg
img
tgz
pdf
rar
tar
zip
exe
mpg
mpeg
avi
mov
gz"

BACKUP_FILENAME=`date '+%Y-%m-%d'`
BACKUP_DEST_DIR="/home/jbsnake/backups/"

cur_dir=`pwd`
echo "$EXCLUDE_BACKUP_EXT" > "${cur_dir}/excludelist.dat"
echo "$BACKUP_DIRS" > "${cur_dir}/dirs2backup.dat"


function create_exclude_list
{
   until ! read dir
   do
      until ! read extension
      do
         find "${dir}" -name "*.${extension}" 2> /dev/null >> "${cur_dir}/excludedfiles.dat"
      done < "${cur_dir}/excludelist.dat"
   done < "${cur_dir}/dirs2backup.dat"
}

create_exclude_list

tar --exclude-from "${cur_dir}/excludedfiles.dat" -czvf "${BACKUP_DEST_DIR}${HOSTNAME}--${BACKUP_FILENAME}.tgz" ${BACKUP_DIRS}

Author:  jbsnake [ Thu Jun 02, 2005 10:15 pm ]
Post subject: 

6-02-05

:: creating a function that will take user input to build a list of directories to backup

:: creating a function that will take user input to build a list of extensions to ignore during backup

:: creating a function that will take user input to build a configuration file to read from so that the script may be used automatically and no user intervention will be necessary.

so far that's all the ideas i have and are working on :) :)

Page 1 of 1 All times are UTC - 6 hours
© 2000, 2002, 2005, 2007 phpBB Group • http://www.phpbb.com