2021-11-01

Generic Linux RSYNC script to manage all the crazy options

I use this for my own backups at home.

The command line arguments are source and destination and these may or may not include one SSH access filesystem.   Include "--delete" to delete changes from the destination that are no longer in the source.

If named "rs":
rs /etc backup@10.10.10.33:/lv1/backup

DO NOT include the source directory (for example above "etc') in the destination address.  It doesn't work right if you do.  Do ask, hours of suffering rsync, knowing it was better than graphical options.

#!/usr/bin/bash
#  named "rs"
IFS=$(echo -en "\n\b")
echo -------------------------
echo -----STARTING------------
echo ---------- $* ---------------
datestart=`/usr/bin/date`
echo $datestart
echo -------------------------
echo -------------------------
/usr/bin/rsync --progress --protect-args -rvv --update --whole-file $* | /usr/bin/egrep -v "uptodate|\/$|newer"
echo -------------------------
echo -------FINISHED----------
echo ---------- $* ---------------
echo started $datestart
/usr/bin/date
echo -------------------------
echo -------------------------



No comments:

Post a Comment

Linux NetworkManager command line configuration

 Configure Network Settings Using Network Manager in Linux Last updated: March 25, 2025 Written by:baeldung Network ConfigurationNetworkMana...