1
Some checks failed
Docker Build & Deploy / Build Docker Image (push) Failing after 8s
Docker Build & Deploy / Deploy to Production (push) Has been skipped

This commit is contained in:
孙诚
2025-03-07 12:05:39 +08:00
parent 8c01529fc9
commit 41a69f44d3
3 changed files with 49 additions and 1 deletions

View File

@@ -0,0 +1,31 @@
using System.Diagnostics;
using FluentScheduler;
using Interface.Jobs;
namespace Service.Jobs;
public class DiskMonitorRegistry : Registry, IDiskMonitorRegistry
{
public void Job()
{
// 执行 cmd 命令 获取执行结果
var command = "df -h";
var process = new Process
{
StartInfo = new ()
{
FileName = "/bin/bash",
Arguments = $"-c \"{command}\"",
RedirectStandardOutput = true,
UseShellExecute = false,
CreateNoWindow = true
}
};
process.Start();
var result = process.StandardOutput.ReadToEnd();
process.WaitForExit();
Console.WriteLine(result);
}
}