]> jfr.im git - uguu.git/commitdiff
fixed
authornokonoko <redacted>
Wed, 18 Nov 2020 12:04:23 +0000 (13:04 +0100)
committernokonoko <redacted>
Wed, 18 Nov 2020 12:04:23 +0000 (13:04 +0100)
README.md
checkdb.sh [new file with mode: 0644]
checkfiles.sh [new file with mode: 0644]

index 1c9af827a08b6b4eb309f15ebf6f80fffb8c48b0..9b3296aa70ffb7fcaf1649b015dc0393756cb317 100644 (file)
--- a/README.md
+++ b/README.md
@@ -69,6 +69,14 @@ increase POST size limits in `php.ini` and webserver configuration. For PHP,
 modify `upload_max_filesize` and `post_max_size` values. The configuration
 option for nginx webserver is `client_max_body_size`.
 
+Edit checkdb.sh and checkfiles.sh to the proper paths then add them to your crontab:
+```bash
+0,30 * * * * bash /path/to/checkfiles.sh
+0,30 * * * * bash /path/to/checkdb.sh
+```
+
+These scripts check if DB entries and files are older then 24 hours and if they are deletes them.
+
 Example nginx configs can be found in confs/.
 
 ## Using SQLite as DB engine
diff --git a/checkdb.sh b/checkdb.sh
new file mode 100644 (file)
index 0000000..7f6916f
--- /dev/null
@@ -0,0 +1 @@
+sqlite3 /path/to/db/uguu.sq3 "DELETE FROM files WHERE date <= strftime('%s', datetime('now', '-1 day'));"
\ No newline at end of file
diff --git a/checkfiles.sh b/checkfiles.sh
new file mode 100644 (file)
index 0000000..5c9e4bd
--- /dev/null
@@ -0,0 +1,2 @@
+#! /bin/sh
+find /path/to/files/ -mmin +1440 -exec rm -f {} \;
\ No newline at end of file