mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-04 05:53:43 +00:00 
			
		
		
		
	This is a slightly tweaked version of the tool Keegan was using for these backups. (imported from commit c9fb7f0585c219703130fe1431ea40ca7320408e)
		
			
				
	
	
		
			36 lines
		
	
	
		
			712 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			36 lines
		
	
	
		
			712 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
#!/bin/bash -ex
 | 
						|
 | 
						|
cd /home/tabbott/humbug-backups
 | 
						|
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
 | 
						|
 | 
						|
cd wikidata
 | 
						|
git pull
 | 
						|
 | 
						|
function commit {
 | 
						|
    git commit --allow-empty -a -m '[AUTO] backup'
 | 
						|
    git repack -da
 | 
						|
}
 | 
						|
 | 
						|
cd ../message_logs
 | 
						|
for h in staging.humbughq.com app.humbughq.com; do
 | 
						|
    rsync -v humbug@$h:logs/event_log/events.* .
 | 
						|
done
 | 
						|
git add events.*
 | 
						|
commit
 | 
						|
 | 
						|
cd ../trac
 | 
						|
rsync -v humbug@trac.humbughq.com:trac/db/trac.db .
 | 
						|
commit
 |