Просмотр исходного кода

1.unity增加同步到Linux功能
2.服务器增加Start脚本

tanghai 9 лет назад
Родитель
Сommit
c217daa9d7

+ 8 - 2
Server/Model/Component/AppManagerComponent.cs

@@ -39,14 +39,20 @@ namespace Model
 #if __MonoCS__
 				const string exe = @"mono";
 				string arguments = $"App.exe --id={startConfig.Options.Id} --appType={startConfig.Options.AppType}";
+				const string workDir = @"../Server/Bin/Debug";
 #else
 				const string exe = @"App.exe";
 				string arguments = $"--id={startConfig.Options.Id} --appType={startConfig.Options.AppType}";
+				const string workDir = @"..\Server\Bin\Debug";
 #endif
-				ProcessStartInfo info = new ProcessStartInfo(exe, arguments)
+				Log.Debug($"{startConfig.Options.Id} {MongoHelper.ToJson(startConfig)}"); 
+				ProcessStartInfo info = new ProcessStartInfo
 				{
+					FileName = exe,
+					Arguments = arguments,
+					CreateNoWindow = true,
 					UseShellExecute = true,
-					WorkingDirectory = @"..\Server\Bin\Debug"
+					WorkingDirectory = workDir
 				};
 
 				Process process = Process.Start(info);

+ 5 - 0
Server/Start.sh

@@ -0,0 +1,5 @@
+#!/bin/bash
+
+cd Bin/Debug/
+pkill App.exe
+mono App.exe --id=1 --appType=Manager

+ 6 - 3
Tools/cwRsync/rsyncd.conf

@@ -3,9 +3,12 @@ gid = root
 #strict modes = no
 use chroot = no
 max connections = 100
-
-[Source]
-path = /home/tanghai/Source/
+read only = no
+write only = no
+log file=/var/log/rsyncd.log
+# Remote sync configuration module
+[Tanghai]
+path = /home/tanghai/
 auth users = tanghai
 secrets file = /etc/rsyncd.secrets
 list = yes

+ 11 - 3
Unity/Assets/Editor/RsyncEditor/RsyncEditor.cs

@@ -1,15 +1,23 @@
 using System;
 using System.Diagnostics;
+using Base;
 using UnityEditor;
 
 namespace MyEditor
 {
 	public class RsyncEditor : EditorWindow
 	{
-		[MenuItem("Tools/Rsync")]
+		[MenuItem("Tools/同步到Linux")]
 		private static void ShowUnDisposeObjects()
 		{
-			Process.Start("../Tools/cwRsync/rsync.exe", "");
+			ProcessStartInfo startInfo = new ProcessStartInfo();
+			startInfo.FileName = @"Tools\cwRsync\rsync.exe";
+			startInfo.Arguments = "-vzrtopg --password-file=./Tools/cwRsync/rsync.secrets --exclude-from=./Tools/cwRsync/exclude.txt --delete ./ tanghai@192.168.1.134::Tanghai/Source/Egametang --chmod=ugo=rwX";
+			startInfo.UseShellExecute = true;
+			startInfo.WorkingDirectory = @"..\";
+			Process p = Process.Start(startInfo);
+			p.WaitForExit();
+			Log.Info("同步完成!");
 		}
 	}
-}
+}

+ 2 - 2
Unity/Unity.CSharp.Editor.csproj

@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
   <PropertyGroup>
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@@ -124,4 +124,4 @@
     <None Include="Assets\CSharp 6.0 Support\AsyncTools\Plugins\System.Threading.xml" />
   </ItemGroup>
   <Import Project="$(MSBuildExtensionsPath)\SyntaxTree\UnityVS\2015\UnityVS.CSharp.targets" />
-</Project>
+</Project>