reminder-bot/bin/reminder-rs-clean-old

13 lines
403 B
Plaintext
Raw Normal View History

2024-10-12 21:12:01 +00:00
#!/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;