Log to destination (#280)
This commit is contained in:
@@ -26,6 +26,9 @@ On macOS, it has a few disadvantages compared to Time Machine - in particular it
|
|||||||
not be managed by the script - in particular they will not be
|
not be managed by the script - in particular they will not be
|
||||||
automatically deleted.
|
automatically deleted.
|
||||||
Default: /home/backuper/.rsync_tmbackup
|
Default: /home/backuper/.rsync_tmbackup
|
||||||
|
--log-to-destination Set the log file directory to the destination directory. If this flag
|
||||||
|
is set, generated files will not be managed by the script - in particular
|
||||||
|
they will not be automatically deleted.
|
||||||
--strategy Set the expiration strategy. Default: "1:1 30:7 365:30" means after one
|
--strategy Set the expiration strategy. Default: "1:1 30:7 365:30" means after one
|
||||||
day, keep one backup per day. After 30 days, keep one backup every 7 days.
|
day, keep one backup per day. After 30 days, keep one backup every 7 days.
|
||||||
After 365 days keep one backup every 30 days.
|
After 365 days keep one backup every 30 days.
|
||||||
|
|||||||
@@ -46,6 +46,9 @@ fn_display_usage() {
|
|||||||
echo " not be managed by the script - in particular they will not be"
|
echo " not be managed by the script - in particular they will not be"
|
||||||
echo " automatically deleted."
|
echo " automatically deleted."
|
||||||
echo " Default: $LOG_DIR"
|
echo " Default: $LOG_DIR"
|
||||||
|
echo " --log-to-destination Set the log file directory to the destination directory. If this flag"
|
||||||
|
echo " is set, generated files will not be managed by the script - in particular"
|
||||||
|
echo " they will not be automatically deleted."
|
||||||
echo " --strategy Set the expiration strategy. Default: \"1:1 30:7 365:30\" means after one"
|
echo " --strategy Set the expiration strategy. Default: \"1:1 30:7 365:30\" means after one"
|
||||||
echo " day, keep one backup per day. After 30 days, keep one backup every 7 days."
|
echo " day, keep one backup per day. After 30 days, keep one backup every 7 days."
|
||||||
echo " After 365 days keep one backup every 30 days."
|
echo " After 365 days keep one backup every 30 days."
|
||||||
@@ -277,6 +280,7 @@ DEST_FOLDER=""
|
|||||||
EXCLUSION_FILE=""
|
EXCLUSION_FILE=""
|
||||||
LOG_DIR="$HOME/.$APPNAME"
|
LOG_DIR="$HOME/.$APPNAME"
|
||||||
AUTO_DELETE_LOG="1"
|
AUTO_DELETE_LOG="1"
|
||||||
|
LOG_TO_DEST="0"
|
||||||
EXPIRATION_STRATEGY="1:1 30:7 365:30"
|
EXPIRATION_STRATEGY="1:1 30:7 365:30"
|
||||||
AUTO_EXPIRE="1"
|
AUTO_EXPIRE="1"
|
||||||
|
|
||||||
@@ -318,6 +322,10 @@ while :; do
|
|||||||
LOG_DIR="$1"
|
LOG_DIR="$1"
|
||||||
AUTO_DELETE_LOG="0"
|
AUTO_DELETE_LOG="0"
|
||||||
;;
|
;;
|
||||||
|
--log-to-destination)
|
||||||
|
LOG_TO_DEST="1"
|
||||||
|
AUTO_DELETE_LOG="0"
|
||||||
|
;;
|
||||||
--no-auto-expire)
|
--no-auto-expire)
|
||||||
AUTO_EXPIRE="0"
|
AUTO_EXPIRE="0"
|
||||||
;;
|
;;
|
||||||
@@ -439,6 +447,10 @@ MYPID="$$"
|
|||||||
# Create log folder if it doesn't exist
|
# Create log folder if it doesn't exist
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
if [[ $LOG_TO_DEST == "1" ]]; then
|
||||||
|
LOG_DIR="$DEST_FOLDER/.$APPNAME"
|
||||||
|
fi
|
||||||
|
|
||||||
if [ ! -d "$LOG_DIR" ]; then
|
if [ ! -d "$LOG_DIR" ]; then
|
||||||
fn_log_info "Creating log folder in '$LOG_DIR'..."
|
fn_log_info "Creating log folder in '$LOG_DIR'..."
|
||||||
mkdir -- "$LOG_DIR"
|
mkdir -- "$LOG_DIR"
|
||||||
|
|||||||
Reference in New Issue
Block a user