Skip to content

Commit

Permalink
Add tail option for compatibility
Browse files Browse the repository at this point in the history
Fix #25.
  • Loading branch information
pedroetb committed Jun 20, 2022
1 parent 9ab9d02 commit 02890ce
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions rsync-incremental-backup-local
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,13 @@ else
writeToLog "\\n[$(${logDateCmd})] Logs sending disabled, deleting old local logs"

# Remove all logs except current one
ls -r ${tempLogPath}/*.log | tail +2 | xargs -r rm
ls -r ${tempLogPath}/*.log | tail -n +2 | xargs -r rm
fi

writeToLog "\\n[$(${logDateCmd})] Deleting excess of logs at target"

# Try to delete excess of log files, older first
[ -d ${logPath} ] && ls -r ${logPath}/*.log | tail +${maxLogFiles} | xargs -r rm
[ -d ${logPath} ] && ls -r ${logPath}/*.log | tail -n +${maxLogFiles} | xargs -r rm

# Rotate backups if last rsync succeeded ..
if [ ! -e "${rotationLockFilePath}" ]
Expand Down
4 changes: 2 additions & 2 deletions rsync-incremental-backup-remote
Original file line number Diff line number Diff line change
Expand Up @@ -124,13 +124,13 @@ else
writeToLog "\\n[$(${logDateCmd})] Logs sending disabled, deleting old local logs"

# Remove all logs except current one
ls -r ${tempLogPath}/*.log | tail +2 | xargs -r rm
ls -r ${tempLogPath}/*.log | tail -n +2 | xargs -r rm
fi

writeToLog "\\n[$(${logDateCmd})] Deleting excess of logs at target"

# Try to delete excess of log files, older first
ssh "${sshParams[@]}" "${remote}" "[ -d ${logPath} ] && ls -r ${logPath}/*.log | tail +${maxLogFiles} | xargs -r rm"
ssh "${sshParams[@]}" "${remote}" "[ -d ${logPath} ] && ls -r ${logPath}/*.log | tail -n +${maxLogFiles} | xargs -r rm"

# Rotate backups if last rsync succeeded ..
if (ssh "${sshParams[@]}" "${remote}" "[ ! -d ${partialFolderPath} ] && [ ! -e ${rotationLockFilePath} ]")
Expand Down
4 changes: 2 additions & 2 deletions rsync-incremental-backup-system
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,13 @@ else
writeToLog "\\n[$(${logDateCmd})] Logs sending disabled, deleting old local logs"

# Remove all logs except current one
ls -r ${tempLogPath}/*.log | tail +2 | xargs -r rm
ls -r ${tempLogPath}/*.log | tail -n +2 | xargs -r rm
fi

writeToLog "\\n[$(${logDateCmd})] Deleting excess of logs at target"

# Try to delete excess of log files, older first
[ -d ${logPath} ] && ls -r ${logPath}/*.log | tail +${maxLogFiles} | xargs -r rm
[ -d ${logPath} ] && ls -r ${logPath}/*.log | tail -n +${maxLogFiles} | xargs -r rm

# Rotate backups if last rsync succeeded ..
if [ ! -e "${rotationLockFilePath}" ]
Expand Down
4 changes: 2 additions & 2 deletions rsync-incremental-backup-system-remote
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,13 @@ else
writeToLog "\\n[$(${logDateCmd})] Logs sending disabled, deleting old local logs"

# Remove all logs except current one
ls -r ${tempLogPath}/*.log | tail +2 | xargs -r rm
ls -r ${tempLogPath}/*.log | tail -n +2 | xargs -r rm
fi

writeToLog "\\n[$(${logDateCmd})] Deleting excess of logs at target"

# Try to delete excess of log files, older first
ssh "${sshParams[@]}" "${remote}" "[ -d ${logPath} ] && ls -r ${logPath}/*.log | tail +${maxLogFiles} | xargs -r rm"
ssh "${sshParams[@]}" "${remote}" "[ -d ${logPath} ] && ls -r ${logPath}/*.log | tail -n +${maxLogFiles} | xargs -r rm"

# Rotate backups if last rsync succeeded ..
if (ssh "${sshParams[@]}" "${remote}" "[ ! -d ${partialFolderPath} ] && [ ! -e ${rotationLockFilePath} ]")
Expand Down

0 comments on commit 02890ce

Please sign in to comment.