From 07fa9c2763775fe326e5aec08f8f4ee570072f5b Mon Sep 17 00:00:00 2001 From: Stefan Huber Date: Sun, 13 May 2012 23:10:07 +0200 Subject: [PATCH] adding man page, sample conf, makefile --- Makefile | 16 ++++++ shbackup | 10 ++-- shbackup.1 | 60 ++++++++++++++++++++++ shbackup.conf | 43 ++++++++++++++++ shbackup.docbook | 130 +++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 254 insertions(+), 5 deletions(-) create mode 100644 Makefile create mode 100644 shbackup.1 create mode 100644 shbackup.conf create mode 100644 shbackup.docbook diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..2365971 --- /dev/null +++ b/Makefile @@ -0,0 +1,16 @@ +PREFIX=/usr +# Where the script binary should go +BINPATH = $(PREFIX)/bin +# Where the manpage should go +MANPATH = $(PREFIX)/share/man +CONFFILE = /etc/shbackup.conf + +###################################################################### + +all: + +install: all + install -m 0755 shbackup $(BINPATH)/shbackup + install -m 0644 shbackup.conf $(CONFFILE) + install -m 0644 shbackup.1 $(MANPATH)/man1/shbackup.1 + diff --git a/shbackup b/shbackup index ca00a13..cc323c5 100755 --- a/shbackup +++ b/shbackup @@ -65,7 +65,7 @@ class Config: def __str__(self): return "[name: " + self.name + ", dirs: " + str(self.dirs) + "]" - formats = ["tar.gz", "tar.bz2", "tar.xz" ] + formats = ["tar", "tar.gz", "tar.bz2", "tar.xz" ] # Filename where checksum of config is saved checksumfn = "checksum" @@ -380,12 +380,12 @@ def printUsage(): print(" prune prune outdated/old backups") print("") print("Options:") - print(" -C use given configuration file") + print(" -h, --help print this usage text") + print(" -c, --conf use given configuration file") print(" default: /etc/shbackup.conf") - print(" -m, --mode override mode: full, diff, or incr") print(" -e, --epoch force to create backup for given epoch:") print(" year, month, week, day, hour, sporadic") - print(" -h, --help print this usage text") + print(" -m, --mode override mode: full, diff, or incr") if __name__ == "__main__": @@ -404,7 +404,7 @@ if __name__ == "__main__": printUsage() exit(0) - elif opt in ["-C", "--config"]: + elif opt in ["-c", "--conf"]: i += 1 conffn = sys.argv[i] diff --git a/shbackup.1 b/shbackup.1 new file mode 100644 index 0000000..4788fe3 --- /dev/null +++ b/shbackup.1 @@ -0,0 +1,60 @@ +'\" -*- coding: us-ascii -*- +.if \n(.g .ds T< \\FC +.if \n(.g .ds T> \\F[\n[.fam]] +.de URL +\\$2 \(la\\$1\(ra\\$3 +.. +.if \n(.g .mso www.tmac +.TH shbackup 1 2012-05-13 "" "" +.SH NAME +shbackup \- a simple backup solution +.SH SYNOPSIS +'nh +.fi +.ad l +\fBshbackup\fR \kx +.if (\nx>(\n(.l/2)) .nr x (\n(.l/5) +'in \n(.iu+\nxu +[options] {\fIcommand\fR} +'in \n(.iu-\nxu +.ad b +'hy +.SH DESCRIPTION +\fBshbackup\fR is a simple backup solution +which packs user-defined file sets with tar. Each +backup belongs to an epoch, which can be year, month, +week, day, hour or sporadic. The backup can be made +either full, differential or incremental. +\fBshbackup\fR takes care for pruning old +backups. The user defines for each epoch the number of +backups to keep, except for 'sporadic'. Sporadic +backups need to be removed manually. +.SH COMMANDS +.TP +\*(T<\fBbackup\fR\*(T> +Make a backup +.TP +\*(T<\fBlist\fR\*(T> +List all backups +.TP +\*(T<\fBprune\fR\*(T> +Prune outdated/stale backups +.SH OPTIONS +.TP +\*(T<\fB\-h, \-\-help\fR\*(T> +Print out a help summary. +.TP +\*(T<\fB\-c, \-\-conf FILE\fR\*(T> +Use given configuration file instead of +/etc/shbackup.conf. +.TP +\*(T<\fB\-e, \-\-epoch EPOCH\fR\*(T> +Do not determine epoch automatically, but +use EPOCH, which can be year, month, +week, day, hour, sporadic. +.TP +\*(T<\fB\-m, \-\-mode MODE\fR\*(T> +Instead of configured mode use MODE, +which can be full, diff or incr. +.SH AUTHOR +Stefan HUBER diff --git a/shbackup.conf b/shbackup.conf new file mode 100644 index 0000000..fb293cf --- /dev/null +++ b/shbackup.conf @@ -0,0 +1,43 @@ +[destination] +# Where shbackup stores the backups and other stuff +directory = ./backup +# Which format should be used by tar? +# One of tar, tar.gz, tar.bz2, tar.xz +format = tar.gz + + +[history] +# keepEPOCH contains the number of backups that are kept for that particular +# epoch, where EPOCH can be year, month, week, day, or hour. modeEPOCH defines +# the backup mode for that particular epoch. Mode can be full, diff or incr. +keephour = 1 +keepday = 14 +keepweek = 2 +keepmonth = 12 +keepyear = 2 +modehour = incr +modeday = diff +modeweek = full +modemonth = full +modeyear = full + + +[input] +# exclude* contains --exclude patterns for tar. Files matching the pattern are +# not included into the backup. +exclude1 = */tmp/* +exclude2 = */[Cc]cache/* +exclude3 = */log* +exclude5 = /home/*/.wine/* +exclude7 = /lib/layman/* + +# A file set called 'home'. Each file set is packed into one archive using tar. +[set home] +# dir* is one directory which belongs to this file set. +dir1 = /home/username/ +dir2 = /media/books/ + +[set conf] +dir1 = /etc/ + + diff --git a/shbackup.docbook b/shbackup.docbook new file mode 100644 index 0000000..73b2fe8 --- /dev/null +++ b/shbackup.docbook @@ -0,0 +1,130 @@ + + + + + + + + + Stefan + Huber + + 2012-05-13 + + + + shbackup + 1 + + + + shbackup + a simple backup solution + + + + + shbackup + options + command + + + + + DESCRIPTION + + + shbackup is a simple backup solution + which packs user-defined file sets with tar. Each + backup belongs to an epoch, which can be year, month, + week, day, hour or sporadic. The backup can be made + either full, differential or incremental. + + shbackup takes care for pruning old + backups. The user defines for each epoch the number of + backups to keep, except for 'sporadic'. Sporadic + backups need to be removed manually. + + + + + + COMMANDS + + + + + + + Make a backup + + + + + + + List all backups + + + + + + + Prune outdated/stale backups + + + + + + + + + OPTIONS + + + + + + + Print out a help summary. + + + + + + + Use given configuration file instead of + /etc/shbackup.conf. + + + + + + + Do not determine epoch automatically, but + use EPOCH, which can be year, month, + week, day, hour, sporadic. + + + + + + + Instead of configured mode use MODE, + which can be full, diff or incr. + + + + + + + + AUTHOR + + + Stefan HUBER + + + -- 2.30.2