From a35348ba256408baa0640357f8a9d9ca02eca7b8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Florent=20Thi=C3=A9ry?= <florent.thiery@ubicast.eu>
Date: Mon, 12 Mar 2018 10:42:56 +0100
Subject: [PATCH] auto purge unpublished files after 60 days, fixes #24829

---
 10.MediaImport/2.Install_FTP_watch_folder/0_setup.py         | 1 +
 10.MediaImport/2.Install_FTP_watch_folder/cron.d/mediaimport | 2 ++
 2 files changed, 3 insertions(+)
 create mode 100644 10.MediaImport/2.Install_FTP_watch_folder/cron.d/mediaimport

diff --git a/10.MediaImport/2.Install_FTP_watch_folder/0_setup.py b/10.MediaImport/2.Install_FTP_watch_folder/0_setup.py
index b6e25e4b..668ba7c0 100644
--- a/10.MediaImport/2.Install_FTP_watch_folder/0_setup.py
+++ b/10.MediaImport/2.Install_FTP_watch_folder/0_setup.py
@@ -22,6 +22,7 @@ def setup(interactive=True):
         'mkdir -p /usr/local/bin',
         'cp "%s/mediaimport_create_ftp_user.sh" /usr/local/bin' % (dir_path),
         'cp "%s/mediaimport_remove_ftp_user.sh" /usr/local/bin' % (dir_path),
+        'cp "%s/cron.d/* /etc/cron.d' % dir_path,
         'mkdir -p /home/ftp/storage',
         'mkdir -p /home/ftp/storage/incoming',
         'mkdir -p /home/ftp/storage/watchfolder',
diff --git a/10.MediaImport/2.Install_FTP_watch_folder/cron.d/mediaimport b/10.MediaImport/2.Install_FTP_watch_folder/cron.d/mediaimport
new file mode 100644
index 00000000..e4058d37
--- /dev/null
+++ b/10.MediaImport/2.Install_FTP_watch_folder/cron.d/mediaimport
@@ -0,0 +1,2 @@
+# purge mediaimport files that are older than 60 days
+0 23 * * * root /usr/bin/find /home/ftp/storage/incoming/ -type f -mtime +60 -delete
-- 
GitLab