rsyncit is a shell script that I use to synchronize directories on my computer with directories on the many web sites I administer. It allows me to place a file in a directory I want to sync that contains all the necessary information to
ssh to the remote host. I use keypairs instead of passwords. Always.
rsync, which is included in the standard MacOS install, but which you need to install yourself in most Linux distros. It's always one of the first things I add, along with
gcc, and Clozure Common Lisp.
Here's the script:
#!/bin/bash if [[ -z $* ]];then rsync -av ./ `./.sshdir`;else rsync $* `./.sshdir`;fi
The magic executable in each directory is named
.sshdir. Here's the one in my steemit source directory:
DO is shell variable set in one of my login scripts. It's short for "Digital Ocean", my web hosting provider. Nowadays, I add symbolic names to
~/.ssh/config instead, but that's an old one.
There are two ways to use the
The following synchronizes the whole directory, and all its sub-directories.
The following synchronizes just the listed files:
rsyncit -av file1 file2 ...
I slightly updated the script, so that it would not sync
.gitdirectories. Usually, it is better to
git pushthan to simply clone the
It would be more general to have an
.rsyncignorefile containing the patterns to ignore, but that will hair up the script a bit to check for the existence of that file. I'll do it should I need it. Or maybe I'll make a github directory containing the shell scripts I've written over the years.