diff --git a/delete_old_mail.sh b/delete_old_mail.sh index 6a91c72..c8a0c71 100755 --- a/delete_old_mail.sh +++ b/delete_old_mail.sh @@ -1,7 +1,11 @@ #!/bin/sh +if [ -z "$DB_PATH" ]; then + DB_PATH="db.db" +fi + min_date="$(date -d '-1 day' +%s)" sql="DELETE FROM mails WHERE mails.arrived_at < $min_date;" -echo "$sql" | sqlite3 db.db +echo "$sql" | sqlite3 "$DB_PATH"