#!/bin/bash
# /usr/local/bin/synctriweekly
# http://crystalfaeries.net/posix/bin/synctriweekly
# celeste:crystalfaery 2015-09-29 16:56:13+00:00
let result=0 # success
echo "`now` ======= $0 ======= $1 =======" || let result=1 # counting forwards from beginning of file
if [ "$1" == "--dry-run" ]
then
dryrun="--dry-run" # only testing
else
dryrun="" # do it for real
fi
# sync with my_twin
cd $HOME || exit -1
echo "rsync -auvzH $dryrun ~/.*.triweekly.txt `my_twin`:~"
rsync -auvzH $dryrun ~/.*.triweekly.txt `my_twin`:~
echo "rsync -auvzH $dryrun `my_twin`:~/.*.triweekly.txt ~"
rsync -auvzH $dryrun `my_twin`:~/.*.triweekly.txt ~
let result=$? # save the result code to return as my result code (pass through unless we override with our own error)
echo "`now` ------- $0 ------- $1 -------" || let result=255 # counting backwards from end of file
exit $result
syntax highlighted by Code2HTML, v. 0.9.1