This commit is contained in:
孙诚
2025-02-27 16:58:21 +08:00
commit 80ab8d76eb
40 changed files with 2482 additions and 0 deletions

View File

@@ -0,0 +1,46 @@
using System.Net;
using Core;
using FluentScheduler;
using Interface.Jobs;
namespace Service.Jobs;
public class StartupRegistry : Registry, IStartupRegistry
{
public StartupRegistry()
{
Schedule(Job).ToRunNow();
}
public async void Job()
{
try
{
// await JobExecute();
}
catch (Exception e)
{
Console.WriteLine(e);
await WxNotify.SendCommonAsync($"StartupRegistry.Job() error: {e}");
}
}
private async Task JobExecute()
{
var commands = new[]
{
"chmod 777 /var/run/docker.sock",
};
var (responseCode, _) = await Command.ExecAsync(commands);
if (responseCode != HttpStatusCode.OK)
{
await WxNotify.SendCommonAsync($"StartupRegistry.Job() error: {responseCode}");
}
else
{
await WxNotify.SendCommonAsync("StartupRegistry.Job() success");
}
}
}