aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/purge-old-pastes.sh
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/purge-old-pastes.sh')
-rwxr-xr-xscripts/purge-old-pastes.sh8
1 files changed, 8 insertions, 0 deletions
diff --git a/scripts/purge-old-pastes.sh b/scripts/purge-old-pastes.sh
new file mode 100755
index 0000000..a22ded8
--- /dev/null
+++ b/scripts/purge-old-pastes.sh
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+# This script is intend to be run as a cron job (every day for ex) to purge
+# old pastes.
+
+pastedir="$(python3 -c 'import config; print(config.pastedir)')"
+timeout="$(python3 -c 'import config; print(config.timeout)')"
+find "$pastedir" -type f -mtime +"$timeout" -exec rm {} \;