fixed grammar & output of script
:
This commit is contained in:
parent
ef2bb4f28a
commit
4b409db718
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# do-daily-backup.sh #
|
# do-daily-btrfs-snapshot.sh #
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# This script is my attempt at replicating the same function that timeshift #
|
# This script is my attempt at replicating the same function that timeshift #
|
||||||
# performs. This is a very simplified script to handle automated btrfs #
|
# performs. This is a very simplified script to handle automated btrfs #
|
||||||
@ -26,9 +26,9 @@
|
|||||||
# BEGIN: Variables
|
# BEGIN: Variables
|
||||||
|
|
||||||
## Reusable vars
|
## Reusable vars
|
||||||
DATE=`date +%Y-%m-%d`
|
DATE=$(date +%Y-%m-%d)
|
||||||
### Getting the name of the script (as it will be the first thing passed to bash when executing)
|
### Getting the name of the script (as it will be the first thing passed to bash when executing)
|
||||||
SCRIPT=`basename $0`
|
SCRIPT=$(basename $0)
|
||||||
BACKUP_DIR=/.backups
|
BACKUP_DIR=/.backups
|
||||||
### Setting dir to house log files
|
### Setting dir to house log files
|
||||||
LOG_DIR=/var/log/$SCRIPT
|
LOG_DIR=/var/log/$SCRIPT
|
||||||
@ -57,7 +57,7 @@ function handle_logs() {
|
|||||||
cd $LOG_DIR
|
cd $LOG_DIR
|
||||||
echo "Began Handling logs at: $(date)"
|
echo "Began Handling logs at: $(date)"
|
||||||
local ARCHIVE_FILE=archive.tar.gz
|
local ARCHIVE_FILE=archive.tar.gz
|
||||||
local ARCHIVE_FILE_UNZIPED=${ARCHIVE_FILE%.gz}
|
local ARCHIVE_FILE_UNZIPPED=${ARCHIVE_FILE%.gz}
|
||||||
|
|
||||||
if [[ -f $ARCHIVE_FILE ]]; then
|
if [[ -f $ARCHIVE_FILE ]]; then
|
||||||
## Decompressing archive in case it exists
|
## Decompressing archive in case it exists
|
||||||
@ -82,11 +82,11 @@ function handle_logs() {
|
|||||||
|
|
||||||
echo "Adding archived logs to archive"
|
echo "Adding archived logs to archive"
|
||||||
## Updating archive
|
## Updating archive
|
||||||
tar uvf $ARCHIVE_FILE_UNZIPED ${FILES_TO_ARCHIVE[@]}
|
tar uvf $ARCHIVE_FILE_UNZIPPED ${FILES_TO_ARCHIVE[@]}
|
||||||
|
|
||||||
## Compressing Archive
|
## Compressing Archive
|
||||||
echo "Compressing Archive"
|
echo "Compressing Archive"
|
||||||
gzip $ARCHIVE_FILE_UNZIPED
|
gzip $ARCHIVE_FILE_UNZIPPED
|
||||||
|
|
||||||
## Removing archived logs
|
## Removing archived logs
|
||||||
echo "Removing archived files"
|
echo "Removing archived files"
|
||||||
@ -154,7 +154,7 @@ for SUBVOL_INFO in ${SUBVOLS[@]}; do
|
|||||||
if [[ ! -d $SNAPSHOT ]]; then
|
if [[ ! -d $SNAPSHOT ]]; then
|
||||||
/usr/sbin/btrfs subvol snapshot -r $DIR $SNAPSHOT
|
/usr/sbin/btrfs subvol snapshot -r $DIR $SNAPSHOT
|
||||||
else
|
else
|
||||||
echo "$SNAPSHOT already existed. Not backing up"
|
echo "$SNAPSHOT already existed. Not doing a snapshot"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user