Implementing code remote synchronization under Mac

Source: Internet
Author: User
Tags rsync zend

Recently replaced the office computer from Windows to Mac, previously used Windows, under Windows to synchronize code to the remote development machine, Zend Studio has some built-in tools, but the Mac Zend Stduio without this tool. and sublime some synchronization plug-in is too difficult to use, so online search, to achieve synchronization.

1, in the background of the Mac run a script, the principle is to use the Mac's Fswatch command to detect changes in the directory files, and then through the rsync command to synchronize the changed files to the remote development machine, the code is as follows:

Pwd="/users/huangxuan01/desktop/baidu/adu/eap-dp-platform/fe/"CD $PWDfswatch $PWD| whileReadfile DoEcho "======"
#只需要相对路径sub_path=${file/${pwd}/}Echo$sub _path
#去掉第一个斜线sub_path=${sub_path/\//}Echo$sub _pathif[-F ${file}-o-d ${file} ] Thenrsync-ar ${sub_path} rsync://10.100.45.234:8667/wwwfiEcho "======" Done

2, on the remote development machine, run the rsync server. The configuration is as follows:

ID=Work Port=8667Address=127.0.0.1GID=Workusechroot=Nomax Connections=TenStrict Modes=Yeslogfile=/home/work/Rsync.logpidfile=/home/work/Rsync.pid[www]path=/home/work/baidu/adu/eap-dp-platform/fe/Comment=Analyseread only=falsehosts allow= *

Implementing code remote synchronization under Mac

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.