2013-04-16 22:49:48 +02:00
|
|
|
#!/bin/bash -ex
|
|
|
|
|
2013-10-31 19:14:47 +01:00
|
|
|
cd /home/tabbott/zulip-backups
|
2013-04-16 22:49:48 +02:00
|
|
|
log="$(pwd)"/log
|
|
|
|
|
|
|
|
# Redirect output to a log file, with timestamps.
|
|
|
|
# Save original stderr as fd 3.
|
|
|
|
exec 3>&2 > >(ts >> "$log") 2>&1
|
|
|
|
|
|
|
|
# On error, print the log file to original stderr, so I get mail.
|
|
|
|
function handle_error {
|
|
|
|
echo 'Error occurred while running backup' >&3
|
|
|
|
tail "$log" >&3
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
trap handle_error ERR
|
|
|
|
|
|
|
|
function commit {
|
|
|
|
git commit --allow-empty -a -m '[AUTO] backup'
|
|
|
|
git repack -da
|
|
|
|
}
|
|
|
|
|
2014-01-24 19:56:32 +01:00
|
|
|
cd message_logs
|
2013-07-24 23:24:13 +02:00
|
|
|
for h in staging.zulip.net prod0.zulip.net; do
|
2013-10-04 20:23:48 +02:00
|
|
|
rsync -v zulip@$h:logs/event_log/events.* .
|
2013-04-16 22:49:48 +02:00
|
|
|
done
|
|
|
|
git add events.*
|
|
|
|
commit
|
|
|
|
|
2013-10-31 19:16:45 +01:00
|
|
|
cd ../wiki
|
2013-07-25 20:57:27 +02:00
|
|
|
ssh root@trac.zulip.net php /usr/share/mediawiki/maintenance/dumpBackup.php --full > mediawiki.xml
|
|
|
|
commit
|