From a1dc67b9f66d35d1ac23655181c6bf13b526031d Mon Sep 17 00:00:00 2001 From: DrGraypFroot <33982978+DrGraypFroot@users.noreply.github.com> Date: Thu, 5 Jul 2018 16:07:56 +0200 Subject: [PATCH] Added latest script version and some description --- Python-Backup-Script-for-Wekan-Docker-environment.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Python-Backup-Script-for-Wekan-Docker-environment.md b/Python-Backup-Script-for-Wekan-Docker-environment.md index 12dd86e..882e9ac 100644 --- a/Python-Backup-Script-for-Wekan-Docker-environment.md +++ b/Python-Backup-Script-for-Wekan-Docker-environment.md @@ -1,7 +1,7 @@ # Features * reads values from config file (db-name, container-name, retention of backups, target-path) -* - +* executes mongodump and copies it to the host system +* checks the target backup directory for existing dumps and deletes them if they reached a certain age This backup script is meant to be executed via cronjob. Example crontab (Backup daily at 18:30): @@ -9,7 +9,7 @@ Example crontab (Backup daily at 18:30): 30 18 * * * /usr/local/sbin/wekandump/wekandump.py /usr/local/sbin/wekandump/wekandump.yml > /dev/null 2>&1 ``` -The script automatically deletes backups that are older then the specified value of retention in the yaml file. +Adjust the retention value in the yaml-config file to suit your needs (see example .yml file at the bottom of the page) The output of the script contains the result of the mongodump as you would see it when dumping manually. Otherwise it only outputs something in case of failure. To enable informative output even in case of success, remove all the # before the lines containing "print ...." @@ -190,8 +190,8 @@ def getcrtime(item): return crtime def housekeep(): - #get all filenames located in the dump-directory - call = 'ls {}'.format(Config.config('dump_path')) + #get all filenames beginning with "dump-" located in the dump-directory + call = 'ls {}'.format(os.path.join(Config.config('dump_path'), "dump-*")) output = subprocess.check_output(call, universal_newlines=True, shell=True) output = output.rstrip() dumps = output.split('\n')