You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
582 B

  1. #!/bin/sh
  2. # Parent backup directory
  3. parent_directory="/var/backup_server/$(hostname -s)"
  4. # Directories to backup
  5. backup_me_up_daddy="/etc /var/www /var/named /var/log /home"
  6. # Check and create backup directory
  7. date_of_backup=`date +%Y_%m_%d_%H_%M`
  8. backup_directory=${parent_directory}/fs_${date_of_backup}
  9. mkdir -p $backup_directory
  10. # Perform backup
  11. for directory in $backup_me_up_daddy
  12. do
  13. archive=`echo ${directory} | sed s/^\\\/// | sed s/\\\//_/g`
  14. tar pcfzP ${backup_directory}/${archive}.tgz ${directory} 2>&1 | tee > ${backup_directory}/${archive}.log
  15. done