Skip to content

Instantly share code, notes, and snippets.

@kopiro
Created August 14, 2011 14:55
Show Gist options
  • Save kopiro/1144950 to your computer and use it in GitHub Desktop.
Save kopiro/1144950 to your computer and use it in GitHub Desktop.
AutoSync Directory with SSH Server
#!/bin/bash
# Sync directory between client and SSH server
usr='VOSTRO_UTENTE_SUL_SERVER_SHH'
srv='SSH_SERVER'
rdir='~/remote/directory/to/sync'
ldir='~/local/directory/to/sync/' #use the / at the end to do not sync the same folder, but only files in the directory
slp='30' # timeout between each request, in seconds
while (true) do
rsync -av $ldir $usr@$srv:$rdir
sleep $slp
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment