#! /bin/sh # # This file is part of DisOrder # Copyright (C) 2011 Richard Kettlewell # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # set -e # Maximum backup age MAXAGE=7 # Enable backups BACKUP=true # Enable pruning PRUNE=true # All operator to override settings if test -e /etc/default/disorder; then . /etc/default/disorder fi if ${BACKUP}; then # Ensure the backup directory exists mkdir -m 0700 -p /var/lib/disorder/backups # Take a backup disorder-dump --dump /var/lib/disorder/backups/$(date +%F) fi if ${PRUNE}; then # Delete old backups find /var/lib/disorder/backups -type f -ctime +${MAXAGE} -print0 \ | xargs -r0 rm -f fi