Browse Source

change structure of repo

master
James McDermott 3 years ago
parent
commit
ee4f29cb90
1 changed files with 19 additions and 0 deletions
  1. +19
    -0
      admin-scripts/backup

+ 19
- 0
admin-scripts/backup View File

@@ -0,0 +1,19 @@
#!/bin/sh

# Parent backup directory
parent_directory="/var/backup_server/$(hostname -s)"

# Directories to backup
backup_me_up_daddy="/etc /var/www /var/named /var/log /home"

# Check and create backup directory
date_of_backup=`date +%Y_%m_%d_%H_%M`
backup_directory=${parent_directory}/fs_${date_of_backup}
mkdir -p $backup_directory

# Perform backup
for directory in $backup_me_up_daddy
do
archive=`echo ${directory} | sed s/^\\\/// | sed s/\\\//_/g`
tar pcfzP ${backup_directory}/${archive}.tgz ${directory} 2>&1 | tee > ${backup_directory}/${archive}.log
done

Loading…
Cancel
Save