#!/bin/bash
# /usr/local/bin/synccalendar
# http://crystalfaeries.net/posix/bin/synccalendar
# celeste:crystalfaery 2016-02-20 06:33:47+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 ~/.{calendar,*.triweekly.txt} `my_twin`:~"
rsync -auvzH $dryrun ~/.{calendar,*.triweekly.txt} `my_twin`:~
echo "rsync -auvzH $dryrun `my_twin`:~/.{calendar,*.triweekly.txt} ~"
rsync -auvzH $dryrun `my_twin`:~/.{calendar,*.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