This commit is contained in:
snltty
2023-11-17 09:40:39 +08:00
parent f09a92c0a4
commit d3c852fdfa
9 changed files with 33 additions and 24 deletions

View File

@@ -114,7 +114,7 @@ params += " --share-key cmonitor/share --share-len 2550";
//server //server
params = " --mode server --web 1800 --api 1801 --service 1802"; params = " --mode server --web 1800 --api 1801 --service 1802";
schtasks.exe /create /tn "cmonitor" /rl highest /sc ONLOGON /delay 0000:30 /tr "\"{exePath}\"{params}" /f schtasks.exe /create /tn "cmonitor" /rl highest /sc ONSTART /delay 0000:30 /tr "\"{exePath}\"{params}" /f
``` ```
##### linux服务端 systemd ##### linux服务端 systemd
``` ```

View File

@@ -138,7 +138,7 @@ namespace cmonitor.install.win
if (installed == false) if (installed == false)
{ {
string str = CommandHelper.Windows(string.Empty, new string[] { string str = CommandHelper.Windows(string.Empty, new string[] {
$"schtasks.exe /create /tn \"cmonitorService\" /rl highest /sc ONLOGON /delay 0000:30 /tr \"\"{exePath}\" {paramStr}\" " $"schtasks.exe /create /tn \"cmonitorService\" /rl highest /sc ONSTART /delay 0000:30 /tr \"\"{exePath}\" {paramStr}\" "
}); });
if (installSas) if (installSas)
{ {

View File

@@ -207,6 +207,8 @@ namespace cmonitor
serviceCollection.AddSingleton<IWebServer, WebServer>(); serviceCollection.AddSingleton<IWebServer, WebServer>();
} }
private static void InitConfig(Config config, Dictionary<string, string> dic) private static void InitConfig(Config config, Dictionary<string, string> dic)
{
try
{ {
config.Server = IPAddress.Parse(dic["server"]); config.Server = IPAddress.Parse(dic["server"]);
config.Name = dic["name"]; config.Name = dic["name"];
@@ -226,6 +228,11 @@ namespace cmonitor
config.IsCLient = dic.ContainsKey("mode") && dic["mode"].Contains("client"); config.IsCLient = dic.ContainsKey("mode") && dic["mode"].Contains("client");
config.IsServer = dic.ContainsKey("mode") && dic["mode"].Contains("server"); config.IsServer = dic.ContainsKey("mode") && dic["mode"].Contains("server");
} }
catch (Exception ex)
{
Logger.Instance.Error(ex);
}
}
private static void LoggerConsole() private static void LoggerConsole()
{ {

View File

@@ -12,7 +12,8 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
<TargetFramework>net8.0</TargetFramework> <TargetFramework>net8.0</TargetFramework>
<RuntimeIdentifier>win-x64</RuntimeIdentifier> <RuntimeIdentifier>win-x64</RuntimeIdentifier>
<SelfContained>true</SelfContained> <SelfContained>true</SelfContained>
<PublishSingleFile>false</PublishSingleFile> <PublishSingleFile>true</PublishSingleFile>
<PublishReadyToRun>false</PublishReadyToRun> <PublishReadyToRun>false</PublishReadyToRun>
<PublishTrimmed>true</PublishTrimmed>
</PropertyGroup> </PropertyGroup>
</Project> </Project>

View File

@@ -4,7 +4,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
--> -->
<Project> <Project>
<PropertyGroup> <PropertyGroup>
<History>True|2023-11-16T03:49:56.3722044Z;True|2023-11-16T11:48:06.3192199+08:00;True|2023-11-16T11:47:35.3708397+08:00;True|2023-11-16T11:45:11.0208634+08:00;False|2023-11-16T11:44:01.7611210+08:00;True|2023-10-01T17:27:31.0065885+08:00;True|2023-09-04T18:19:54.7492652+08:00;True|2023-09-04T18:19:32.2969345+08:00;False|2023-09-04T18:18:51.7827366+08:00;True|2023-09-04T18:15:31.6783417+08:00;True|2023-09-04T18:14:40.9964104+08:00;</History> <History>True|2023-11-17T01:24:26.3650754Z;True|2023-11-17T09:11:28.0867966+08:00;True|2023-11-17T09:09:49.7366925+08:00;False|2023-11-17T09:08:56.6254247+08:00;False|2023-11-17T09:08:45.4560896+08:00;True|2023-11-16T11:49:56.3722044+08:00;True|2023-11-16T11:48:06.3192199+08:00;True|2023-11-16T11:47:35.3708397+08:00;True|2023-11-16T11:45:11.0208634+08:00;False|2023-11-16T11:44:01.7611210+08:00;True|2023-10-01T17:27:31.0065885+08:00;True|2023-09-04T18:19:54.7492652+08:00;True|2023-09-04T18:19:32.2969345+08:00;False|2023-09-04T18:18:51.7827366+08:00;True|2023-09-04T18:15:31.6783417+08:00;True|2023-09-04T18:14:40.9964104+08:00;</History>
<LastFailureDetails /> <LastFailureDetails />
</PropertyGroup> </PropertyGroup>
</Project> </Project>

View File

@@ -12,6 +12,7 @@
<Configurations>Debug;Release;ReleaseLinux</Configurations> <Configurations>Debug;Release;ReleaseLinux</Configurations>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS> <DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
<PublishAot>false</PublishAot> <PublishAot>false</PublishAot>
<JsonSerializerIsReflectionEnabledByDefault>true</JsonSerializerIsReflectionEnabledByDefault>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">

View File

@@ -13,7 +13,7 @@ do
do do
for r in ${rs[@]} for r in ${rs[@]}
do do
dotnet publish ./${f} -c release -f net7.0 -o ./public/publish/docker/linux-${p}-${r}/${f} -r ${p}-${r} --self-contained true -p:TieredPGO=true -p:DebugType=none -p:DebugSymbols=false -p:PublishSingleFile=true -p:PublishTrimmed=true -p:EnableCompressionInSingleFile=true -p:DebuggerSupport=false -p:EnableUnsafeBinaryFormatterSerialization=false -p:EnableUnsafeUTF7Encoding=false -p:HttpActivityPropagationSupport=false -p:InvariantGlobalization=true -p:MetadataUpdaterSupport=false -p:UseSystemResourceKeys=true -p:TrimMode=partial dotnet publish ./${f} -c release -f net8.0 -o ./public/publish/docker/linux-${p}-${r}/${f} -r ${p}-${r} --self-contained true -p:TieredPGO=true -p:DebugType=none -p:DebugSymbols=false -p:PublishSingleFile=true -p:PublishTrimmed=true -p:EnableCompressionInSingleFile=true -p:DebuggerSupport=false -p:EnableUnsafeBinaryFormatterSerialization=false -p:EnableUnsafeUTF7Encoding=false -p:HttpActivityPropagationSupport=false -p:InvariantGlobalization=true -p:MetadataUpdaterSupport=false -p:UseSystemResourceKeys=true -p:TrimMode=partial
cp -rf public/publish/docker/linux-${p}-${r}/${f}/${f} public/publish/docker/linux-${p}-${r}/${f}/${f}.run cp -rf public/publish/docker/linux-${p}-${r}/${f}/${f} public/publish/docker/linux-${p}-${r}/${f}/${f}.run
rm -rf public/publish/docker/linux-${p}-${r}/${f}/${f} rm -rf public/publish/docker/linux-${p}-${r}/${f}/${f}
cp -rf cmonitor/Dockerfile-${p} public/publish/docker/linux-${p}-${r}/${f}/Dockerfile-${p} cp -rf cmonitor/Dockerfile-${p} public/publish/docker/linux-${p}-${r}/${f}/Dockerfile-${p}

View File

@@ -5,12 +5,12 @@ rd /s /q public\\publish-zip
mkdir public\\publish-zip mkdir public\\publish-zip
dotnet publish ./cmonitor -c release -f net7.0 -o ./public/publish/win-x64 -r win-x64 -p:PublishTrimmed=true -p:TrimMode=partial --self-contained true -p:TieredPGO=true -p:DebugType=none -p:DebugSymbols=false -p:PublishSingleFile=true -p:EnableCompressionInSingleFile=true -p:DebuggerSupport=false -p:EnableUnsafeBinaryFormatterSerialization=false -p:EnableUnsafeUTF7Encoding=false -p:HttpActivityPropagationSupport=false -p:InvariantGlobalization=true -p:MetadataUpdaterSupport=false -p:UseSystemResourceKeys=true dotnet publish ./cmonitor -c release -f net8.0 -o ./public/publish/win-x64 -r win-x64 -p:PublishTrimmed=true -p:TrimMode=partial --self-contained true -p:TieredPGO=true -p:DebugType=none -p:DebugSymbols=false -p:PublishSingleFile=true -p:EnableCompressionInSingleFile=true -p:DebuggerSupport=false -p:EnableUnsafeBinaryFormatterSerialization=false -p:EnableUnsafeUTF7Encoding=false -p:HttpActivityPropagationSupport=false -p:InvariantGlobalization=true -p:MetadataUpdaterSupport=false -p:UseSystemResourceKeys=true
dotnet publish ./cmonitor -c releaselinux -f net7.0 -o ./public/publish/linux-x64 -r linux-x64 -p:PublishTrimmed=true --self-contained true -p:TieredPGO=true -p:DebugType=none -p:DebugSymbols=false -p:PublishSingleFile=true -p:EnableCompressionInSingleFile=true -p:DebuggerSupport=false -p:EnableUnsafeBinaryFormatterSerialization=false -p:EnableUnsafeUTF7Encoding=false -p:HttpActivityPropagationSupport=false -p:InvariantGlobalization=true -p:MetadataUpdaterSupport=false -p:UseSystemResourceKeys=true -p:TrimMode=partial dotnet publish ./cmonitor -c releaselinux -f net8.0 -o ./public/publish/linux-x64 -r linux-x64 -p:PublishTrimmed=true --self-contained true -p:TieredPGO=true -p:DebugType=none -p:DebugSymbols=false -p:PublishSingleFile=true -p:EnableCompressionInSingleFile=true -p:DebuggerSupport=false -p:EnableUnsafeBinaryFormatterSerialization=false -p:EnableUnsafeUTF7Encoding=false -p:HttpActivityPropagationSupport=false -p:InvariantGlobalization=true -p:MetadataUpdaterSupport=false -p:UseSystemResourceKeys=true -p:TrimMode=partial
dotnet publish ./cmonitor -c release -f net7.0 -r win-x64 -o ./public/publish/win-x64-any/ -p:PublishSingleFile=true --self-contained false dotnet publish ./cmonitor -c release -f net8.0 -r win-x64 -o ./public/publish/win-x64-any/ -p:PublishSingleFile=true --self-contained false
dotnet publish ./cmonitor -c releaselinux -f net7.0 -r linux-x64 -o ./public/publish/linux-x64-any/ -p:PublishSingleFile=true --self-contained false dotnet publish ./cmonitor -c releaselinux -f net8.0 -r linux-x64 -o ./public/publish/linux-x64-any/ -p:PublishSingleFile=true --self-contained false
for %%r in (win-x64,win-x64-any) do ( for %%r in (win-x64,win-x64-any) do (