Restructured to better break up backups and add user control
This commit is contained in:
parent
0aa26c388d
commit
652d7c4795
3
Makefile
3
Makefile
@ -23,11 +23,12 @@ server: keys scripts user ./aether-gen.bash ./aether.pub ./server-backup
|
|||||||
bash ./aether-gen.bash
|
bash ./aether-gen.bash
|
||||||
cp ./aether.pub /home/aether/.ssh/authorized_keys
|
cp ./aether.pub /home/aether/.ssh/authorized_keys
|
||||||
cp ./aether-gen.bash /root/bin/aether-gen.bash
|
cp ./aether-gen.bash /root/bin/aether-gen.bash
|
||||||
mkdir /usr/local/etc/Aether
|
mkdir -p /usr/local/etc/Aether/backup-entries
|
||||||
touch /usr/local/etc/Aether/nodeslist
|
touch /usr/local/etc/Aether/nodeslist
|
||||||
mkdir -p ${BACKUPDIR};
|
mkdir -p ${BACKUPDIR};
|
||||||
make checkperm
|
make checkperm
|
||||||
@echo You have the files. Add aether-gen.bash and server-backup to root\'s crontab.
|
@echo You have the files. Add aether-gen.bash and server-backup to root\'s crontab.
|
||||||
|
@echo Mark services to be backed up by adding a file from examples/ to /usr/local/etc/Aether/backup-entries
|
||||||
@echo Track client nodes in /usr/local/etc/Aether/nodeslist
|
@echo Track client nodes in /usr/local/etc/Aether/nodeslist
|
||||||
|
|
||||||
user: aether make-user.bash
|
user: aether make-user.bash
|
||||||
|
@ -2,12 +2,21 @@
|
|||||||
|
|
||||||
export LOGFILE="/var/log/aether-gen.log"
|
export LOGFILE="/var/log/aether-gen.log"
|
||||||
|
|
||||||
/usr/local/src/Aether/server-backup
|
export BACKUPDIR="/usr/local/backup"
|
||||||
|
export BACKUPCMD="rsync -avzl --delete-after";
|
||||||
|
|
||||||
|
date >> "$LOGFILE"
|
||||||
|
chown root:root "$BACKUPDIR"
|
||||||
|
chmod 0770 "$BACKUPDIR"
|
||||||
|
|
||||||
|
for i in `find /usr/local/etc/Aether/backup-entries/ -type f`; do
|
||||||
|
bash "${i}" &>> "$LOGFILE"
|
||||||
|
done
|
||||||
|
|
||||||
|
date > "$BACKUPDIR"/lastbackup.date
|
||||||
|
|
||||||
cd /home/aether
|
cd /home/aether
|
||||||
|
|
||||||
date >> $LOGFILE
|
|
||||||
|
|
||||||
echo Creating and compressing archive...
|
echo Creating and compressing archive...
|
||||||
tar cvf aether.tar /usr/local/backup
|
tar cvf aether.tar /usr/local/backup
|
||||||
gzip -f aether.tar
|
gzip -f aether.tar
|
||||||
@ -18,5 +27,5 @@ rm aether.tar.gz
|
|||||||
|
|
||||||
echo Created aether archive.
|
echo Created aether archive.
|
||||||
|
|
||||||
date >> $LOGFILE
|
date >> "$LOGFILE"
|
||||||
echo >> $LOGFILE
|
echo >> "$LOGFILE"
|
||||||
|
4
examples/cron.backup.script
Normal file
4
examples/cron.backup.script
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
### Cron ###
|
||||||
|
crontab -l > "$BACKUPDIR"/$(whoami)-crontab
|
||||||
|
|
6
examples/foundation.backup.script
Normal file
6
examples/foundation.backup.script
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
### Foundation ###
|
||||||
|
$BACKUPCMD /srv/foundation/ "$BACKUPDIR"/Foundation &>/dev/null
|
||||||
|
$BACKUPCMD /usr/local/etc/ "$BACKUPDIR"/usr-local-etc
|
||||||
|
|
||||||
|
|
4
examples/grimoire.backup.script
Normal file
4
examples/grimoire.backup.script
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
### Grimoire ###
|
||||||
|
sudo -u postgres pg_dumpall > "$BACKUPDIR"/grimoire.sql
|
||||||
|
|
7
examples/irc.backup.script
Normal file
7
examples/irc.backup.script
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
### IRC Server ###
|
||||||
|
$BACKUPCMD /etc/unrealircd/ "$BACKUPDIR"/unrealircd
|
||||||
|
$BACKUPCMD /etc/anope/ "$BACKUPDIR"/anope
|
||||||
|
cp /opt/anope/data/anope.db "$BACKUPDIR"
|
||||||
|
|
||||||
|
|
5
examples/singularity.backup.script
Normal file
5
examples/singularity.backup.script
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
### Singularity ###
|
||||||
|
cp /usr/share/webapps/tt-rss/config.php "$BACKUPDIR"/singularity-config.php
|
||||||
|
sudo -u postgres pg_dump ttrss > "$BACKUPDIR"/ttrss.psql
|
||||||
|
|
4
examples/sshd.backup.script
Normal file
4
examples/sshd.backup.script
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
### SSHD ###
|
||||||
|
mkdir -p "$BACKUPDIR"/ssh
|
||||||
|
$BACKUPCMD /etc/ssh "$BACKUPDIR"/ssh
|
5
examples/webserver.backup.script
Normal file
5
examples/webserver.backup.script
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
### Lighttpd ###
|
||||||
|
mkdir -p "$BACKUPDIR"/lighttpd "$BACKUPDIR"/http
|
||||||
|
$BACKUPCMD /etc/lighttpd/ "$BACKUPDIR"/lighttpd
|
||||||
|
$BACKUPCMD /srv/http/ "$BACKUPDIR"/http/
|
9
examples/wiki.backup.script
Normal file
9
examples/wiki.backup.script
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
### Wiki ###
|
||||||
|
mkdir "$BACKUPDIR"/wiki/
|
||||||
|
for i in `find /usr/share/webapps/ -maxdepth 1 -type d | grep mediawiki`; do
|
||||||
|
foldername="$(echo "$i" | rev | cut -f 1 -d '/' | rev)"
|
||||||
|
dbname="$(grep '^\$wgDBname' "$i"/LocalSettings.php | cut -f 2 -d \")"
|
||||||
|
$BACKUPCMD "${i}"/LocalSettings.php "$BACKUPDIR"/wiki/"$foldername"-localsettings.php
|
||||||
|
sudo -u postgres pg_dump "$dbname" > "$BACKUPDIR"/wiki/"$dbname".psql
|
||||||
|
done
|
9
examples/yggdrasil.backup.script
Normal file
9
examples/yggdrasil.backup.script
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
### 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
|
||||||
|
|
||||||
|
|
@ -1,62 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
export BACKUPDIR="/usr/local/backup"
|
|
||||||
export BACKUPCMD="rsync -avzl --delete-after";
|
|
||||||
|
|
||||||
## Backup small development ##
|
|
||||||
chown postgres:root "$BACKUPDIR"
|
|
||||||
chmod 0770 "$BACKUPDIR"
|
|
||||||
|
|
||||||
$BACKUPCMD /root/bin/ "$BACKUPDIR"/root/bin/
|
|
||||||
|
|
||||||
## Backup configuration ##
|
|
||||||
cp -r /etc/skel "$BACKUPDIR"
|
|
||||||
cp /etc/bash.bashrc "$BACKUPDIR"/bash.bashrc
|
|
||||||
cp /etc/vimrc "$BACKUPDIR"/vimrc
|
|
||||||
|
|
||||||
## Backup the good servers ##
|
|
||||||
|
|
||||||
### SSHD ###
|
|
||||||
$BACKUPCMD /etc/ssh "$BACKUPDIR"/ssh
|
|
||||||
|
|
||||||
### Lighttpd ###
|
|
||||||
$BACKUPCMD /etc/lighttpd/ "$BACKUPDIR"/lighttpd
|
|
||||||
$BACKUPCMD /srv/http/ "$BACKUPDIR"/http/
|
|
||||||
|
|
||||||
### Cron ###
|
|
||||||
crontab -l > "$BACKUPDIR"/$(whoami)-crontab
|
|
||||||
|
|
||||||
### IRC Server ###
|
|
||||||
$BACKUPCMD /etc/unrealircd/ "$BACKUPDIR"/unrealircd
|
|
||||||
$BACKUPCMD /etc/anope/ "$BACKUPDIR"/anope
|
|
||||||
cp /opt/anope/data/anope.db "$BACKUPDIR"
|
|
||||||
|
|
||||||
### Foundation ###
|
|
||||||
$BACKUPCMD /srv/foundation/ "$BACKUPDIR"/Foundation
|
|
||||||
$BACKUPCMD /usr/local/etc/ "$BACKUPDIR"/usr-local-etc
|
|
||||||
|
|
||||||
### Wiki ###
|
|
||||||
$BACKUPCMD /usr/share/webapps/mediawiki/LocalSettings.php "$BACKUPDIR"/mediawiki-localsettings.php
|
|
||||||
# Databases backed up by Grimoire
|
|
||||||
|
|
||||||
### Singularity ###
|
|
||||||
cp /usr/share/webapps/tt-rss/config.php "$BACKUPDIR"/singularity-config.php
|
|
||||||
# Databases backed up by Grimoire
|
|
||||||
|
|
||||||
### 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
|
|
||||||
sudo -u postgres pg_dump lykos_wiki > "$BACKUPDIR"/lykos_wiki.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
|
|
Loading…
Reference in New Issue
Block a user