| 
				
			 | 
			
			
				@@ -29,6 +29,26 @@ 
			 | 
		
	
		
			
			| 
				29
			 | 
			
				29
			 | 
			
			
				 # Set this when calling backup and restore commands 
			 | 
		
	
		
			
			| 
				30
			 | 
			
				30
			 | 
			
			
				 USE_POSTGRESQL= 
			 | 
		
	
		
			
			| 
				31
			 | 
			
				31
			 | 
			
			
				 POSTGRESQL_PACKAGES='postgresql-9.6 postgresql-contrib-9.6 postgresql-client' 
			 | 
		
	
		
			
			| 
				
			 | 
			
				32
			 | 
			
			
				+POSTGRESQL_VERSION=9.6 
			 | 
		
	
		
			
			| 
				
			 | 
			
				33
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				34
			 | 
			
			
				+function turn_off_postgresql_logging { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				35
			 | 
			
			
				+    if [ ! -f /etc/postgresql/$POSTGRESQL_VERSION/main/postgresql.conf ]; then 
			 | 
		
	
		
			
			| 
				
			 | 
			
				36
			 | 
			
			
				+        return 
			 | 
		
	
		
			
			| 
				
			 | 
			
				37
			 | 
			
			
				+    fi 
			 | 
		
	
		
			
			| 
				
			 | 
			
				38
			 | 
			
			
				+    sed -i 's|#log_destination|log_destination|g' /etc/postgresql/$POSTGRESQL_VERSION/main/postgresql.conf 
			 | 
		
	
		
			
			| 
				
			 | 
			
				39
			 | 
			
			
				+    sed -i "s|log_destination.*|log_destination = 'syslog'|g" /etc/postgresql/$POSTGRESQL_VERSION/main/postgresql.conf 
			 | 
		
	
		
			
			| 
				
			 | 
			
				40
			 | 
			
			
				+    if [ -d /var/log/postgresql ]; then 
			 | 
		
	
		
			
			| 
				
			 | 
			
				41
			 | 
			
			
				+        $REMOVE_FILES_COMMAND /var/log/postgresql/* 
			 | 
		
	
		
			
			| 
				
			 | 
			
				42
			 | 
			
			
				+    fi 
			 | 
		
	
		
			
			| 
				
			 | 
			
				43
			 | 
			
			
				+} 
			 | 
		
	
		
			
			| 
				
			 | 
			
				44
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				45
			 | 
			
			
				+function turn_on_postgresql_logging { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				46
			 | 
			
			
				+    if [ ! -f /etc/postgresql/$POSTGRESQL_VERSION/main/postgresql.conf ]; then 
			 | 
		
	
		
			
			| 
				
			 | 
			
				47
			 | 
			
			
				+        return 
			 | 
		
	
		
			
			| 
				
			 | 
			
				48
			 | 
			
			
				+    fi 
			 | 
		
	
		
			
			| 
				
			 | 
			
				49
			 | 
			
			
				+    sed -i 's|log_destination|#log_destination|g' /etc/postgresql/$POSTGRESQL_VERSION/main/postgresql.conf 
			 | 
		
	
		
			
			| 
				
			 | 
			
				50
			 | 
			
			
				+    sed -i "s|log_destination.*|log_destination = 'stderr'|g" /etc/postgresql/$POSTGRESQL_VERSION/main/postgresql.conf 
			 | 
		
	
		
			
			| 
				
			 | 
			
				51
			 | 
			
			
				+} 
			 | 
		
	
		
			
			| 
				32
			 | 
			
				52
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				33
			 | 
			
				53
			 | 
			
			
				 function store_original_postgresql_password { 
			 | 
		
	
		
			
			| 
				34
			 | 
			
				54
			 | 
			
			
				     if [ ! -f /root/.postgresqloriginal ]; then 
			 |