Add script to remove old reminders
This commit is contained in:
		
							
								
								
									
										12
									
								
								bin/reminder-rs-clean-old
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										12
									
								
								bin/reminder-rs-clean-old
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,12 @@
 | 
			
		||||
#!/usr/bin/env bash
 | 
			
		||||
 | 
			
		||||
# Load environment
 | 
			
		||||
source /etc/reminder-rs/config.env
 | 
			
		||||
 | 
			
		||||
if [ -z "${SENT_CLEAN_AGE}" ]; then
 | 
			
		||||
  mysql -D reminders -e "DELETE FROM reminders WHERE status != 'pending' AND \`utc_time\` < NOW() - INTERVAL ${SENT_CLEAN_AGE} MONTH"
 | 
			
		||||
fi;
 | 
			
		||||
 | 
			
		||||
if [ -z "${TOTAL_CLEAN_AGE}" ]; then
 | 
			
		||||
  mysql -D reminders -e "DELETE FROM reminders WHERE \`utc_time\` < NOW() - INTERVAL ${TOTAL_CLEAN_AGE} MONTH"
 | 
			
		||||
fi;
 | 
			
		||||
		Reference in New Issue
	
	Block a user