October 31st, 2012, 07:02 AM
Join Date: Aug 2010
Time spent in forums: 14 h 13 m 39 sec
Reputation Power: 4
Writing an rsync shell script on Mac to continuously sync local directory with remote
I need to set up a shell script on Mac OS X Mountain Lion to sync a local directory to a remote directory (web server) using either an SSH connection (tunnel) or SFTP and have it run continuously every 30 seconds.
I also need to exclude certain files or folders from being synced.
The syncing would be unidirectional (mac -> webserver).
The basic parameters I need to have implemented are as follows:
Local path: /Volumes/path/to/local/directory
Remote server: example.com
Remote path: /path/from/server/root/to/htdocs
Files to exclude: '.ht*', '*.sublime-*'
Folders to exclude: 'cache','administrator/cache'
I would also need help writing the crontask and adding it to my system to execute automatically.
Any help would be greatly appreciated.