Foremost Rsync Wrapper Give Progress Bar File Transfers

About writing shell scripts and making the most of your shell
Forum rules
Topics in this forum are automatically closed 6 months after creation.
Locked
microuser

Foremost Rsync Wrapper Give Progress Bar File Transfers

Post by microuser »

In an attempt to make a scriptable command line backup script, I wound up writing a wrapper function for rsync. Some of my backups take longer than a day, and was in need of a progress bar. Since rsync, only has verbose ouptut command --progress and no progress bar, a --dryrun was ran to get the file count, while the command 'pv' was used to output a progress bar. I have been unsucessfull with the use of 'dialog --guage' and would like some assistance.

https://github.com/microuser/Foremost
for instructions see https://github.com/microuser/Foremost/b ... /README.md

I create a discussion here for peer review. For I am sure there are many ways for me to improve this code. Currently, it uses rsync in local mode, where i use the archive mode to merge two similear directory structures.

Code: Select all

#!/bin/bash
#TODO: import that one script i wrote once for auto install.
#sudo apt-get install pv
##TODO: Loop through extra parameters $3...$n while they exist, as well as acceptance for --delete mode
SOURCES=$1
TARGET=$2
#Use ionice as another wrapper for parsing output
RSYNC="ionice -c3 rsync"
#RSYNC_ARGS="-vrltDa --delete --stats --human-readable"
RSYNC_ARGS="-vrltDa --stats --human-readable"
echo "Traversing the filetree while accumulating information about transfer"
RSYNC_FILECOUNT=$(${RSYNC} --dry-run ${RSYNC_ARGS} ${SOURCES} ${TARGET}|grep "^File Count:"|awk '{print $5}')
echo "Beginning RSYNC Transfer"
${RSYNC} ${RSYNC_ARGS} ${SOURCES} ${TARGET} | pv -l -e -p -s "$RSYNC_FILECOUNT"

*PS I just learned about the Scrips & Bash section, I have moved my post from Main->Applications to Scripts & Bash
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
User avatar
grimdestripador
Level 6
Level 6
Posts: 1051
Joined: Fri Feb 16, 2007 2:26 am

Re: Foremost Rsync Wrapper Give Progress Bar File Transfers

Post by grimdestripador »

I just joined merged two directories, the progress bar accuracy is strange. When my transfer ended the status said 106%
Locked

Return to “Scripts & Bash”