1. 程式人生 > 遊戲 >微軟:計劃為Xbox開發3D元宇宙App

微軟:計劃為Xbox開發3D元宇宙App

官網: https://code.google.com/archive/p/sersync/

下載連結: https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/sersync/sersync2.5.4_64bit_binary_stable_final.tar.gz

安裝

wget https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/sersync/sersync2.5.4_64bit_binary_stable_final.tar.gz

tar xf sersync2.5.4_64bit_binary_stable_final.tar.gz 
mv GNU-Linux-x86/ /usr/local/sersync 
ln -s /usr/local/sersync/sersync2 /usr/bin/

配置檔案confxml.xml

<?xml version="1.0" encoding="ISO-8859-1"?>
<head version="2.5">
    <host hostip="localhost" port="8008"></host>
    <debug start="false"/>
    <fileSystem xfs="false"/>
    <filter start="false">
	<exclude expression="(.*)\.svn"></exclude>
	<exclude expression="(.*)\.gz"></exclude>
	<exclude expression="^info/*"></exclude>
	<exclude expression="^static/*"></exclude>
    </filter>
    <inotify>
	<delete start="true"/>
	<createFolder start="true"/>
	<createFile start="false"/>
	<closeWrite start="true"/>
	<moveFrom start="true"/>
	<moveTo start="true"/>
	<attrib start="true"/>  <!-- 屬性也同步 true為開啟 false為關閉-->
	<modify start="false"/>
    </inotify>

    <sersync>
	<localpath watch="/home/bakup">    <!-- 本地伺服器的同步目錄 -->
	    <remote ip="11.7.171.36" name="/home/data_test"/>   <!-- 本機需要和遠端機器配置免密,遠端機器的ip和同步到到目錄地址 -->
	    <!--<remote ip="192.168.8.39" name="tongbu"/>-->
	    <!--<remote ip="192.168.8.40" name="tongbu"/>-->
	</localpath>
	<rsync>
	    <commonParams params="-artuz"/>
	    <auth start="false" users="root" passwordfile="/etc/rsync.pas"/>  <!-- 我這裡使用的shell同步不用配置sync 這裡為false 不用改 -->
	    <userDefinedPort start="false" port="874"/><!-- port=874 -->
	    <timeout start="false" time="100"/><!-- timeout=100 -->
	    <ssh start="true"/>    <!-- 這裡需要啟用 使用的是ssh同步 -->
	</rsync>
	<failLog path="/tmp/rsync_fail_log.sh" timeToExecute="60"/><!--default every 60mins execute once-->
	<crontab start="false" schedule="600"><!--600mins-->
	    <crontabfilter start="false">
		<exclude expression="*.php"></exclude>
		<exclude expression="info/*"></exclude>
	    </crontabfilter>
	</crontab>
	<plugin start="false" name="command"/>
    </sersync>

    <plugin name="command">
	<param prefix="/bin/sh" suffix="" ignoreError="true"/>	<!--prefix /opt/tongbu/mmm.sh suffix-->
	<filter start="false">
	    <include expression="(.*)\.php"/>
	    <include expression="(.*)\.sh"/>
	</filter>
    </plugin>

    <plugin name="socket">
	<localpath watch="/opt/tongbu">
	    <deshost ip="192.168.138.20" port="8009"/>
	</localpath>
    </plugin>
    <plugin name="refreshCDN">
	<localpath watch="/data0/htdocs/cms.xoyo.com/site/">
	    <cdninfo domainname="ccms.chinacache.com" port="80" username="xxxx" passwd="xxxx"/>
	    <sendurl base="http://pic.xoyo.com/cms"/>
	    <regexurl regex="false" match="cms.xoyo.com/site([/a-zA-Z0-9]*).xoyo.com/images"/>
	</localpath>
    </plugin>
</head>

啟動sersync指令碼

cat > /etc/init.d/sersync << EOF
#!/bin/bash 

exispid() {
        pidcount=$(ps -ef |grep sersync2 |grep -v grep |wc -l )
        if [ $pidcount -eq 0 ];then
                return 0   # 沒執行返回0
        else
                return  1 # 執行返回1
        fi
}

sersync_start() {
  exispid
  if [ $? -eq 0 ];then
     /usr/local/sersync/sersync2 -dro /usr/local/sersync/confxml.xml >/dev/null 2>&1
     echo -e "start sersync  \t\t\t\t\t\t\t\t \033[32m [ OK ] \033[0m"
  else
    echo "sersync is runing!"
  fi 
}

sersync_stop() {
  exispid 
  if [ $? -eq 0 ];then
    echo "sersync is stop!"
  else
    kill -9 `ps -ef |grep sersync |grep -v grep  |awk '{print $2}'` >/dev/null 2>&1
     echo -e "stop sersync  \t\t\t\t\t\t\t\t \033[32m [ OK ] \033[0m"
  fi
}

case $1 in
  start )
    sersync_start
    ;;
  stop )
    sersync_stop
    ;;
  restart)
    sersync_stop
    sersync_start
    ;;
  * )
    echo "stop|start|restart|"
    ;;
esac
EOF

chmod +x /etc/init.d/sersync