2016-08-04 11:15:34 -05:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
export BACKUPDIR="/usr/local/backup"
|
2016-08-10 12:38:26 -05:00
|
|
|
export BACKUPCMD="rsync -avzl --delete-after";
|
2016-08-04 11:15:34 -05:00
|
|
|
|
|
|
|
## Backup small development ##
|
2016-08-10 12:38:26 -05:00
|
|
|
chown postgres:root "$BACKUPDIR"
|
|
|
|
chmod 0770 "$BACKUPDIR"
|
2016-08-04 11:15:34 -05:00
|
|
|
|
2016-08-10 12:38:26 -05:00
|
|
|
$BACKUPCMD /root/bin/ "$BACKUPDIR"/root/bin/
|
2016-08-04 11:15:34 -05:00
|
|
|
|
|
|
|
## Backup configuration ##
|
|
|
|
cp -r /etc/skel "$BACKUPDIR"
|
|
|
|
cp /etc/bash.bashrc "$BACKUPDIR"/bash.bashrc
|
|
|
|
cp /etc/vimrc "$BACKUPDIR"/vimrc
|
|
|
|
|
|
|
|
## Backup the good servers ##
|
|
|
|
|
|
|
|
### SSHD ###
|
2016-08-10 12:38:26 -05:00
|
|
|
$BACKUPCMD /etc/ssh "$BACKUPDIR"/ssh
|
2016-08-04 11:15:34 -05:00
|
|
|
|
|
|
|
### Lighttpd ###
|
2016-08-10 12:38:26 -05:00
|
|
|
$BACKUPCMD /etc/lighttpd/ "$BACKUPDIR"/lighttpd
|
|
|
|
$BACKUPCMD /srv/http/ "$BACKUPDIR"/http/
|
2016-08-04 11:15:34 -05:00
|
|
|
|
|
|
|
### Cron ###
|
|
|
|
crontab -l > "$BACKUPDIR"/$(whoami)-crontab
|
|
|
|
|
|
|
|
### IRC Server ###
|
2016-08-10 12:38:26 -05:00
|
|
|
$BACKUPCMD /etc/unrealircd/ "$BACKUPDIR"/unrealircd
|
|
|
|
$BACKUPCMD /etc/anope/ "$BACKUPDIR"/anope
|
|
|
|
cp /opt/anope/data/anope.db "$BACKUPDIR"
|
2016-08-04 11:15:34 -05:00
|
|
|
|
2016-08-10 12:38:26 -05:00
|
|
|
### Foundation ###
|
|
|
|
$BACKUPCMD /srv/foundation/ "$BACKUPDIR"/Foundation
|
|
|
|
$BACKUPCMD /usr/local/etc/ "$BACKUPDIR"/usr-local-etc
|
2016-08-04 11:15:34 -05:00
|
|
|
|
|
|
|
### Wiki ###
|
2016-08-10 12:38:26 -05:00
|
|
|
$BACKUPCMD /usr/share/webapps/mediawiki/LocalSettings.php "$BACKUPDIR"/mediawiki-localsettings.php
|
|
|
|
# Databases backed up by Grimoire
|
2016-08-04 11:15:34 -05:00
|
|
|
|
|
|
|
### Singularity ###
|
2016-08-10 12:38:26 -05:00
|
|
|
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
|
2016-08-04 11:15:34 -05:00
|
|
|
|
2016-08-10 12:38:26 -05:00
|
|
|
### 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
|
2016-08-04 11:15:34 -05:00
|
|
|
|
|
|
|
# TODO evaluate for other services not covered.
|
|
|
|
|
|
|
|
date > /var/log/server-backup.log
|
2016-08-10 12:38:26 -05:00
|
|
|
date > "$BACKUPDIR"/lastbackup.date
|