项目作者: gzachos

项目描述 :
A Bash script that backups the directories specified and manages old backup files.
高级语言: Shell
项目地址: git://github.com/gzachos/backup-script.git
创建时间: 2016-07-09T16:51:46Z
项目社区:https://github.com/gzachos/backup-script

开源协议:GNU General Public License v2.0

下载


backup-script

About

This shell script backups the directories specified in the CONFIGURATION SECTION
by compressing and storing them. It is designed to be executed @midnight (same as
@daily) using Cron.

Details

  • Every “\_BACKUP_DAY” a backup is taken.
  • If no backup was taken the previous week (Mon -> Sun) AND if no backup
    was taken this week, a backup is taken no matter what.
  • Backups older than 5 weeks (counting current week) are deleted unless the
    total number of backups is less than 6 (<=5).

Screenshots


Manual Execution

Manual Execution

Configuration

The configuration section is the only section you should modify, unless you really(!)
know what you are doing!!!

Make sure to always comply with the name format of the example variables.
As you may have noticed, all variables related to each other begin with
the same token (i.e. WIKI, CLOUD, …).

To add any additional directories to be backed up, you should only add three (3)
new lines and modify ${TOKENS} variable. See the examples below to get a better
understanding.

Example of ${TOKENS} variable:

  1. TOKENS="WIKI CLOUD" # For any additional entry add the appropriate
  2. # <token-uppercase> separating it with a space
  3. # character from existing tokens.

Template - The three lines that should be added for every new directory addition.

  1. <token-uppercase>_BACKUPS_DIR="/path/to/dir" # No '/' at the end of the path!
  2. <token-uppercase>_DIR="/path/to/another-dir" # No '/' at the end of the path!
  3. <token-uppercase>_BACKUP_DAY="<weekday-3-letters>"

Example No.1

  1. WIKI_BACKUPS_DIR="/root/backups/wiki" # Where backup files will be saved.
  2. WIKI_DIR="/var/www/html/wiki" # The directory that should be backed up.
  3. WIKI_BACKUP_DAY="Sun" # The day of the week that the backup should be taken.

Execution (Cron)

Example cron entry:

  1. @midnight /root/bin/backup.sh

Developer

George Z. Zachos

Licence

GNU GENERAL PUBLIC LICENSE Version 2, June 1991