63 lines
1.7 KiB
Bash
Executable File
63 lines
1.7 KiB
Bash
Executable File
#!/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
|