solved color in rsynclog

This commit is contained in:
Amber 2022-11-18 17:37:09 +01:00
parent 3690a64053
commit b29cf27a05
3 changed files with 17 additions and 8 deletions

View File

@ -15,17 +15,24 @@
#You should have received a copy of the GNU General Public License
#along with masync. If not, see <http://www.gnu.org/licenses/>.
#
###############################################
# the file contains all sync managed by masync
#
###############################################
SYNCFILE=~/.syncdir.sync
#
# the file contains the snapshot of a stopped sync
#
###############################################
# the file contains the snapshot. A snapshot is the list of files
# locally synchronized when the sync was stopped
###############################################
SNAPSHOTFILE=~/.snapshot_{{hash}}
TMPQUEUEFILE=~/.syncdir_{{hash}}.queue
TMPQUEUEDELETES=~/.syncdir_{{hash}}.deletes
###############################################
# the file when the loop logs the activity
###############################################
SYNCLOOPFILE=~/syncloop_{{hash}}.nohup
###############################################
# raw rsync log (used by .synccmd.sh)
###############################################
LOGFILERSYNC=~/syncdir_{{hash}}.log
################################

View File

@ -39,7 +39,7 @@ sync() {
rsync -ni -aPu --progress --out-format="%i ${GREEN}%n%L${ENDCOLOR} %''b" --log-file=$logfile -e ssh $otheropts $src $dest | \
grep -e "[<|>]" | \
sed -E "s~<(\w|\W){10}~Sending to ${dest}~g" | \
sed -E "s~>(\w|\W){10}~Receiving from ${src}~g" 1>>$syncloopfile 2>&1
sed -E "s~>(\w|\W){10}~Receiving from ${src}~g" | xargs -0 printf 1>>$syncloopfile 2>&1
# last command execution exit code $?"
rsync_result=$?
if [[ ${rsync_result} -ne 0 ]]; then

6
masync
View File

@ -185,9 +185,11 @@ loopsyncpath() {
echo 'Sync already running do nothing...'
exit 0
else
## delete old log file
rm -f ~/syncdir_$hash.log
## delete old rsync log file
rsynclogfile=$(format ${LOGFILERSYNC} hash=$hash)
rm -f ${rsynclogfile}
## starting loop on background and catch pid
syncloopfile=$(format ${SYNCLOOPFILE} hash=$hash)
nohup syncloop.sh $hash $localpath $remotepath 1>~/syncloop_$hash.nohup 2>&1 &
mypid=$!
when=$(date +%s)