forked from ungleich-public/cdist
		
	safer way to check for database existence
Signed-off-by: Steven Armstrong <steven@icarus.ethz.ch>
This commit is contained in:
		
					parent
					
						
							
								2cf67e321e
							
						
					
				
			
			
				commit
				
					
						2fcdf3825b
					
				
			
		
					 1 changed files with 1 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -20,7 +20,7 @@
 | 
			
		|||
 | 
			
		||||
name="$__object_id"
 | 
			
		||||
 | 
			
		||||
if su - postgres -c "psql -l | grep -q '^ *$name'"; then
 | 
			
		||||
if su - postgres -c "echo '\q' | psql '$name'" 2>/dev/null; then
 | 
			
		||||
   echo "present"
 | 
			
		||||
else
 | 
			
		||||
   echo "absent"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue