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" export LOGFILE="/var/log/aether-gen.log"
/usr/local/src/Aether/server-backup
cd /home/aether cd /home/aether
date >> $LOGFILE 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... echo Creating and compressing archive...
tar cvf aether.tar target tar cvf aether.tar /usr/local/backup
gzip -f aether.tar gzip -f aether.tar
echo Encrypting archive echo Encrypting archive

View File

@ -13,5 +13,5 @@ fi
export TARGET="aether-"$(date +%F)".enc" export TARGET="aether-"$(date +%F)".enc"
printf "get /aether/aether.enc %s\nbye\n" $TARGET | sftp -o IdentityFile=./.ssh/aether aether@aninix.net 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 exit

View File

@ -1,10 +1,13 @@
#!/bin/bash #!/bin/bash
export BACKUPDIR="/usr/local/backup" export BACKUPDIR="/usr/local/backup"
export BACKUPCMD="rsync -avzl --delete-after";
## Backup small development ## ## 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 ## ## Backup configuration ##
cp -r /etc/skel "$BACKUPDIR" cp -r /etc/skel "$BACKUPDIR"
@ -14,37 +17,45 @@ cp /etc/vimrc "$BACKUPDIR"/vimrc
## Backup the good servers ## ## Backup the good servers ##
### SSHD ### ### SSHD ###
rsync -avzl --delete-after /etc/ssh "$BACKUPDIR"/ssh $BACKUPCMD /etc/ssh "$BACKUPDIR"/ssh
### Lighttpd ### ### Lighttpd ###
rsync -avzl --delete-after /etc/lighttpd/ "$BACKUPDIR"/lighttpd $BACKUPCMD /etc/lighttpd/ "$BACKUPDIR"/lighttpd
rsync -avzl --delete-after /srv/http/ "$BACKUPDIR"/http/ $BACKUPCMD /srv/http/ "$BACKUPDIR"/http/
### Cron ### ### Cron ###
crontab -l > "$BACKUPDIR"/$(whoami)-crontab crontab -l > "$BACKUPDIR"/$(whoami)-crontab
### IRC Server ### ### IRC Server ###
rsync -avzl --delete-after /etc/unrealircd/ "$BACKUPDIR"/unrealircd $BACKUPCMD /etc/unrealircd/ "$BACKUPDIR"/unrealircd
rsync -avzl --delete-after /etc/anope/ "$BACKUPDIR"/anope $BACKUPCMD /etc/anope/ "$BACKUPDIR"/anope
# TODO add backup cp /opt/anope/data/anope.db "$BACKUPDIR"
### TheRaven ### ### Foundation ###
# Added under Bazaar source $BACKUPCMD /srv/foundation/ "$BACKUPDIR"/Foundation
$BACKUPCMD /usr/local/etc/ "$BACKUPDIR"/usr-local-etc
### 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
### Wiki ### ### 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 ### ### Singularity ###
# Backed up by postgres backup cp /usr/share/webapps/tt-rss/config.php "$BACKUPDIR"/singularity-config.php
# Databases backed up by Grimoire
### PostgreSQL ### ### Grimoire ###
# TODO 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. # TODO evaluate for other services not covered.
date > /var/log/server-backup.log date > /var/log/server-backup.log
date > "$BACKUPDIR"/lastbackup.date