Foremost Rsync Wrapper Give Progress Bar File Transfers

Forum rules
Before you post please read how to get help
microuser
Level 1
Level 1
Posts: 2
Joined: Thu Sep 26, 2013 3:29 pm

Foremost Rsync Wrapper Give Progress Bar File Transfers

Postby microuser » Sat Sep 28, 2013 1:38 pm

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

User avatar
grimdestripador
Level 6
Level 6
Posts: 1057
Joined: Fri Feb 16, 2007 2:26 am

Re: Foremost Rsync Wrapper Give Progress Bar File Transfers

Postby grimdestripador » Sat Sep 28, 2013 1:50 pm

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


Return to “Scripts & Bash”

Who is online

Users browsing this forum: No registered users and 2 guests