From 9d5535a87af2f8d47cb6a9d1f8d85e37305314ba Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Florent=20Thi=C3=A9ry?= <florent.thiery@ubicast.eu>
Date: Thu, 18 May 2017 12:26:39 +0200
Subject: [PATCH] add excluded pattern file, add global lock, refs #20367

---
 9.MediaVault/1.Install_MediaVault/0_setup.py            | 7 ++++---
 9.MediaVault/1.Install_MediaVault/excluded_patterns.txt | 7 +++++++
 2 files changed, 11 insertions(+), 3 deletions(-)
 create mode 100644 9.MediaVault/1.Install_MediaVault/excluded_patterns.txt

diff --git a/9.MediaVault/1.Install_MediaVault/0_setup.py b/9.MediaVault/1.Install_MediaVault/0_setup.py
index 6370c4b4..f2e2c942 100755
--- a/9.MediaVault/1.Install_MediaVault/0_setup.py
+++ b/9.MediaVault/1.Install_MediaVault/0_setup.py
@@ -8,12 +8,13 @@ import os
 
 def setup(interactive=True):
     CROND_TEMPLATE = '''# https://github.com/laurent22/rsync-time-backup
-    0 22 * * * root /usr/local/sbin/rsync_tmbackup.sh /etc root@{backup_server}:/backup/{hostname}/etc
-    0 22 * * * root /usr/local/sbin/rsync_tmbackup.sh /home root@{backup_server}:/backup/{hostname}/home
-    '''
+0 22 * * * root /usr/local/sbin/rsync_tmbackup.sh /etc root@{backup_server}:/backup/{hostname}/etc /etc/backup/excluded_patterns.txt
+0 22 * * * root flock -n /etc/backup/home_backup.lock /usr/local/sbin/rsync_tmbackup.sh /home root@{backup_server}:/backup/{hostname}/home /etc/backup/excluded_patterns.txt'''
 
     cmds = [
         'cp rsync_tmbackup.sh /usr/local/sbin',
+        'mkdir -p /etc/backup',
+        'cp excluded_patterns.txt /etc/backup',
         'cp /tmp/backup.cron /etc/cron.d/',
     ]
 
diff --git a/9.MediaVault/1.Install_MediaVault/excluded_patterns.txt b/9.MediaVault/1.Install_MediaVault/excluded_patterns.txt
new file mode 100644
index 00000000..63a5b693
--- /dev/null
+++ b/9.MediaVault/1.Install_MediaVault/excluded_patterns.txt
@@ -0,0 +1,7 @@
+- .zfs/
+- *.log
+- *.pyc
+- *.swp
+- *.pid
+- *chunked_*/
+- __pycache__/
-- 
GitLab