• mac下实现代码远程同步


    近期将办公电脑从windows换成了mac,以前一直用windows,在windows下面将代码同步到远程的开发机,zend studio有一些内置的工具,但mac下的zend stduio没有了这个工具。而sublime一些同步插件太难用,于是网上搜索,自己来实现同步。

    1,在mac上面后台运行一个脚本,原理就是用mac的fswatch命令检测目录内文件的变化,然后通过rsync命令同步变化的文件到远程开发机,代码如下:

    PWD="/Users/huangxuan01/Desktop/baidu/adu/eap-dp-platform/fe/"
    cd $PWD
    fswatch $PWD  | while read file
    do
    echo "======"
    #只需要相对路径 sub_path=${file/${PWD}/} echo $sub_path
    
    

    if [[ "$sub_path" == *.git* ]];then

    
    

        echo ignore

    
    

        continue

    
    

    fi


    #去掉第一个斜线 sub_path
    =${sub_path///} echo $sub_path if [ -f ${file} -o -d ${file} ] then rsync -aR ${sub_path} rsync://10.100.45.234:8667/www fi echo "======" done

    2,在远程开发机上,运行rsync服务端。配置如下:

    id = work  
    port = 8667
    address = 127.0.0.1
    gid = work
    use chroot = no
    max connections = 10
    strict modes = yes
    log file = /home/work/rsync.log
    pid file = /home/work/rsync.pid
    [www]
    path = /home/work/baidu/adu/eap-dp-platform/fe/
    comment = analyse
    read only = false
    hosts allow = *
  • 相关阅读:
    PHP实现发送模板消息(微信公众号版)
    laravel 跨域问题
    微信授权登录
    支付demo2
    支付demo1
    微信支付注意点
    微信支付方式区分
    debian,dietpi,linux中文乱码解决方法
    嵌入式应该深入专研STM32还是继续学习linux内核驱动呢?
    arduino下载ESP8266开发板的方法
  • 原文地址:https://www.cnblogs.com/hxdoit/p/6888980.html
Copyright © 2020-2023  润新知