Fixes to control backup size and back up the right things. Backups encrypted and labeled as such.

This commit is contained in:
dev 2016-08-10 12:38:26 -05:00
parent 7b7849d98f
commit 0b7c6305e1
3 changed files with 33 additions and 33 deletions

View File

@ -2,25 +2,14 @@
export LOGFILE="/var/log/aether-gen.log"
/usr/local/src/Aether/server-backup
cd /home/aether
date >> $LOGFILE
mkdir -p target
# Get a list of what's in Yggdrasil, in case we need to go hunting.
echo "Getting file list..."
find /srv/yggdrasil/ > target/Yggdrasil_file_list.txt
# Copy the nonrecoverable data to the target location.
rsync -azl --delete-after /usr/local/src/ target/src/
rsync -azl --delete-after /usr/local/etc/ target/etc/
rsync -azl --delete-after /usr/local/backup target/
date > target/last-updated
echo Creating and compressing archive...
tar cvf aether.tar target
tar cvf aether.tar /usr/local/backup
gzip -f aether.tar
echo Encrypting archive

View File

@ -13,5 +13,5 @@ fi
export TARGET="aether-"$(date +%F)".enc"
printf "get /aether/aether.enc %s\nbye\n" $TARGET | sftp -o IdentityFile=./.ssh/aether aether@aninix.net
echo "Failsafe populated. Today\'s was saved to "$TARGET
echo "Aether copy populated. Today\'s was saved to "$TARGET
exit

View File

@ -1,10 +1,13 @@
#!/bin/bash
export BACKUPDIR="/usr/local/backup"
export BACKUPCMD="rsync -avzl --delete-after";
## Backup small development ##
chown postgres:root "$BACKUPDIR"
chmod 0770 "$BACKUPDIR"
rsync -avzl --delete-after /root/bin/ "$BACKUPDIR"/root/bin/
$BACKUPCMD /root/bin/ "$BACKUPDIR"/root/bin/
## Backup configuration ##
cp -r /etc/skel "$BACKUPDIR"
@ -14,37 +17,45 @@ cp /etc/vimrc "$BACKUPDIR"/vimrc
## Backup the good servers ##
### SSHD ###
rsync -avzl --delete-after /etc/ssh "$BACKUPDIR"/ssh
$BACKUPCMD /etc/ssh "$BACKUPDIR"/ssh
### Lighttpd ###
rsync -avzl --delete-after /etc/lighttpd/ "$BACKUPDIR"/lighttpd
rsync -avzl --delete-after /srv/http/ "$BACKUPDIR"/http/
$BACKUPCMD /etc/lighttpd/ "$BACKUPDIR"/lighttpd
$BACKUPCMD /srv/http/ "$BACKUPDIR"/http/
### Cron ###
crontab -l > "$BACKUPDIR"/$(whoami)-crontab
### IRC Server ###
rsync -avzl --delete-after /etc/unrealircd/ "$BACKUPDIR"/unrealircd
rsync -avzl --delete-after /etc/anope/ "$BACKUPDIR"/anope
# TODO add backup
$BACKUPCMD /etc/unrealircd/ "$BACKUPDIR"/unrealircd
$BACKUPCMD /etc/anope/ "$BACKUPDIR"/anope
cp /opt/anope/data/anope.db "$BACKUPDIR"
### TheRaven ###
# Added under Bazaar source
### Bazaar ###
rsync -avzl --delete-after /srv/bazaar/ "$BACKUPDIR"/bazaar
rsync -avzl --delete-after /usr/local/src/ "$BACKUPDIR"/src
rsync -avzl --delete-after /usr/local/etc/ "$BACKUPDIR"/usr-local-etc
### Foundation ###
$BACKUPCMD /srv/foundation/ "$BACKUPDIR"/Foundation
$BACKUPCMD /usr/local/etc/ "$BACKUPDIR"/usr-local-etc
### Wiki ###
rsync -avzl --delete-after /usr/share/webapps/mediawiki/LocalSettings.php "$BACKUPDIR"/mediawiki-localsettings.php
$BACKUPCMD /usr/share/webapps/mediawiki/LocalSettings.php "$BACKUPDIR"/mediawiki-localsettings.php
# Databases backed up by Grimoire
### Singularity ###
# Backed up by postgres backup
cp /usr/share/webapps/tt-rss/config.php "$BACKUPDIR"/singularity-config.php
# Databases backed up by Grimoire
### PostgreSQL ###
# TODO
### Grimoire ###
sudo -u postgres pg_dump aninix_wiki > "$BACKUPDIR"/aninix_wiki.psql
sudo -u postgres pg_dump gb_wiki > "$BACKUPDIR"/gb_wiki.psql
sudo -u postgres pg_dump ttrss > "$BACKUPDIR"/ttrss.psql
### Yggdrasil -- File list only for space reasons ###
if [ -x /usr/bin/locate ]; then
locate /srv/yggdrasil > "$BACKUPDIR"/yggdrasil-file-list.txt
else
find /srv/yggdrasil/ > "$BACKUPDIR"/yggdrasil_file_list.txt
fi
# TODO evaluate for other services not covered.
date > /var/log/server-backup.log
date > "$BACKUPDIR"/lastbackup.date