File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -5,8 +5,8 @@ Allows for creating smaller backups with privacy while allowing
55for partial recovery should any individual incremental archive
66file be damaged.
77
8- Other similar solutions using encryption result in total data
9- loss past failed incremental archive file.
8+ Other similar solutions using incremental files, compression, and
9+ encryption result in total data loss past failed incremental archive file.
1010
1111## Help
1212
Original file line number Diff line number Diff line change @@ -19,6 +19,8 @@ export BCS_COMPRESS="$_arg_compress"
1919export BCS_DECRYPTDIR=" $_arg_decryptdir "
2020export BCS_VERBOSETAR=" $_arg_verbosetar "
2121export BCS_PASSWORD=" $password "
22+ # export BCS_LOWDISKSPACE=5230
23+ export BCS_LOWDISKSPACE=1385
2224
2325PrintOptions ()
2426{
Original file line number Diff line number Diff line change 1414# NOTE: If no password is supplied (as BCS_PASSWORD environment var),
1515# bacchus does not encrypt backup
1616
17+ BCS_DEST=$( < " $BCS_PATHFILE " )
18+ while true ; do
19+ availablespace=$( df -kP " $BCS_DEST " | awk ' {print $4}' | tail -1)
20+ lowspace=" $(( BCS_VOLUMESIZE * BCS_LOWDISKSPACE )) "
21+ printf " availablespace %s\n" " $availablespace "
22+ printf " lowspace %s\n" " $lowspace "
23+ if [ " $availablespace " -lt " $lowspace " ]; then
24+ printf " LOW AVAILABLE SPACE on %s (%s < %s)\n" " $BCS_DEST " " $availablespace " " $lowspace "
25+ printf " Either free-up space or swap out storage device and press enter\n"
26+ printf " Or enter a new destination path and press enter\n"
27+ read newpath
28+ printf " \n"
29+ if [ -n " $newpath " ]; then
30+ BCS_DEST=" $newpath "
31+ echo " $BCS_DEST " > " $BCS_PATHFILE "
32+ fi
33+ else
34+ break
35+ fi
36+ done
37+
1738tararchivedir=$( dirname " $TAR_ARCHIVE " )
1839TAR_ARCHIVE=$( basename " $TAR_ARCHIVE " )
1940name=$( expr " $TAR_ARCHIVE " : ' \(.*\)-.*' )
Original file line number Diff line number Diff line change 77# for partial recovery should any individual incremental archive
88# file be damaged.
99#
10- # Other similar solutions using encryption result in total data
11- # loss past failed incremental archive file.
10+ # Other similar solutions using incremental files, compression, and
11+ # encryption result in total data loss past failed incremental archive file.
1212#
1313# Usage:
1414# bacchus-backup.sh
@@ -39,10 +39,13 @@ Cleanup()
3939 fi
4040 if [[ " $BCS_TMPFILE " == * " tmp" * ]]; then
4141 rm -rf " $BCS_TMPFILE "
42+ rm -rf " $BCS_PATHFILE "
4243 fi
4344}
4445
4546BCS_TMPFILE=$( mktemp -u /tmp/baccus-XXXXXX)
47+ export BCS_PATHFILE=" $BCS_TMPFILE " .dest
48+ echo " $BCS_DEST " > " $BCS_PATHFILE "
4649trap Cleanup EXIT
4750
4851if [ " $BCS_COMPRESS " == " off" ] && [ -z " $BCS_PASSWORD " ]; then
7477tar " $tarargs " --format=posix --sort=name --new-volume-script " $scriptdir /bacchus-backup-new-volume.sh" -L " $BCS_VOLUMESIZE " --volno-file " $BCS_TMPFILE " -f " $BCS_TARDIR " /" $BCS_BASENAME " .tar $BCS_SOURCE
7578
7679# Setup tar variables to call new-volume script for handling last (or possibly only) archive volume
80+ if [ " $BCS_COMPRESS " == " off" ] && [ -z " $BCS_PASSWORD " ]; then
81+ BCS_TARDIR=$( < " $BCS_PATHFILE " )
82+ fi
7783vol=$( cat " $BCS_TMPFILE " )
7884case " $vol " in
7985 1) export TAR_ARCHIVE=" $BCS_TARDIR " /" $BCS_BASENAME " .tar
Original file line number Diff line number Diff line change @@ -25,15 +25,32 @@ oldname="${TAR_ARCHIVE##*/}"
2525
2626echo " $filename "
2727
28- source=" $BCS_SOURCE " /" $filename "
29- if [ " $BCS_COMPRESS " == " on" ]; then
30- source=" $source " .gz
31- rm -f " $BCS_COMPRESDIR " /" $oldname "
32- fi
33- if [ -n " $BCS_PASSWORD " ]; then
34- source=" $source " .gpg
35- rm -f " $BCS_DECRYPTDIR " /" $oldname "
36- fi
28+ BCS_SOURCE=$( < " $BCS_PATHFILE " )
29+ while true ; do
30+ source=" $BCS_SOURCE " /" $filename "
31+ if [ " $BCS_COMPRESS " == " on" ]; then
32+ source=" $source " .gz
33+ rm -f " $BCS_COMPRESDIR " /" $oldname "
34+ fi
35+ if [ -n " $BCS_PASSWORD " ]; then
36+ source=" $source " .gpg
37+ rm -f " $BCS_DECRYPTDIR " /" $oldname "
38+ fi
39+
40+ if [ ! -f " $source " ]; then
41+ printf " Archive volume %s NOT FOUND in %s\n" $( basename " $source " ) " $BCS_SOURCE "
42+ printf " Either place this file in the source directory and press enter\n"
43+ printf " Or enter a new source path and press enter\n"
44+ read newpath
45+ printf " \n"
46+ if [ -n " $newpath " ]; then
47+ BCS_SOURCE=" $newpath "
48+ echo " $BCS_SOURCE " > " $BCS_PATHFILE "
49+ fi
50+ else
51+ break
52+ fi
53+ done
3754
3855case " $TAR_SUBCOMMAND " in
3956 -x) test -r " $source " || exit 1
Original file line number Diff line number Diff line change 77# for partial recovery should any individual incremental archive
88# file be damaged.
99#
10- # Other similar solutions using encryption result in total data
11- # loss of past failed incremental archive file.
10+ # Other similar solutions using incremental files, compression, and
11+ # encryption result in total data loss past failed incremental archive file.
1212#
1313# Usage:
1414# bacchus-restore.sh
1919# BCS_BASENAME - Base filename for backup archive
2020# BCS_VOLUMESIZE - Used LOCALLY here, not from environment
2121# BCS_RAMDISK - Boolean enabling ramdisk
22+ # BCS_TARDIR - Intermediate area for tar
2223# BCS_DECRYPTDIR - Intermediate area to store unencrypted volume
2324# BCS_COMPRESDIR - Intermediate area to store uncompressed volume
2425# BCS_COMPRESS - Boolean enabling compression
@@ -40,10 +41,13 @@ Cleanup()
4041 fi
4142 if [[ " $BCS_TMPFILE " == * " tmp" * ]]; then
4243 rm -rf " $BCS_TMPFILE "
44+ rm -rf " $BCS_PATHFILE "
4345 fi
4446}
4547
4648BCS_TMPFILE=$( mktemp -u /tmp/baccus-XXXXXX)
49+ export BCS_PATHFILE=" $BCS_TMPFILE " .dest
50+ echo " $BCS_SOURCE " > " $BCS_PATHFILE "
4751trap Cleanup EXIT
4852
4953if [ " $BCS_COMPRESS " == " off" ] && [ -z " $BCS_PASSWORD " ]; then
Original file line number Diff line number Diff line change @@ -19,6 +19,8 @@ export BCS_COMPRESS="$_arg_compress"
1919export BCS_DECRYPTDIR=" $_arg_decryptdir "
2020export BCS_VERBOSETAR=" $_arg_verbosetar "
2121export BCS_PASSWORD=" $password "
22+ # export BCS_LOWDISKSPACE=5230
23+ export BCS_LOWDISKSPACE=1385
2224
2325PrintOptions ()
2426{
You can’t perform that action at this time.
0 commit comments