mirror of
				https://gitlab.crans.org/bde/nk20-scripts
				synced 2025-11-04 08:32:10 +01:00 
			
		
		
		
	
		
			
				
	
	
		
			15 lines
		
	
	
		
			308 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			15 lines
		
	
	
		
			308 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
#!/bin/bash
 | 
						|
export $(cat .env_borg | xargs)
 | 
						|
 | 
						|
# Create temporary backups directory
 | 
						|
mkdir -p /tmp/note-backups
 | 
						|
 | 
						|
# Backup database
 | 
						|
sudo -u postgres pg_dump -F t note_db > $BACKUP_FILE
 | 
						|
 | 
						|
# Keep the last 30 backups
 | 
						|
borg prune --keep-last 30
 | 
						|
 | 
						|
# Save backup
 | 
						|
borg create --compression lz4 ::backup-{now} $BACKUP_FILE
 |