From ed82c38af4ffc0abcd7868bfdd5f4075c5333fe0 Mon Sep 17 00:00:00 2001 From: Guilherme Rugai Freire Date: Tue, 20 Feb 2024 02:09:46 -0300 Subject: [PATCH] add script to delete old mail currently, the script is hardcoded for emails older than 1 day this is a script because it is a simple operation and probably will be called by a cronjob --- delete_old_mail.sh | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100755 delete_old_mail.sh diff --git a/delete_old_mail.sh b/delete_old_mail.sh new file mode 100755 index 0000000..6a91c72 --- /dev/null +++ b/delete_old_mail.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +min_date="$(date -d '-1 day' +%s)" +sql="DELETE FROM mails WHERE mails.arrived_at < $min_date;" + +echo "$sql" | sqlite3 db.db +