Last active
August 29, 2015 14:08
-
-
Save karmatr0n/156ea9b0f192a5182f8e to your computer and use it in GitHub Desktop.
Simple script to delete files from records stored in a PostgreSQL database
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
l=1000 | |
psql_cmd="/usr/local/bin/psql" | |
while [ 1 ]; | |
do | |
records=`$psql_cmd -U syslog_writer -d vigilante -t << EOF | |
DELETE FROM images_logs WHERE id IN (SELECT id FROM images_logs ORDER BY uploaded_at LIMIT $l); | |
EOF` | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment