【发布时间】:2020-09-07 09:16:46
【问题描述】:
您好,有一项服务需要执行独立于 .Core 进程的更新后的 shell 脚本。我试过 /bin/bash、/bin/nohup 和 /bin/setsid。但是每次脚本停止 systemd 服务时,脚本似乎也被停止了。我怎样才能让它独立?
private static Process StartLinuxUpdateScript(string pathToUpdateScript, string pathToUpdateZip)
{
var process = new Process()
{
StartInfo = new ProcessStartInfo
{
FileName = "/bin/setsid",
UseShellExecute = true,
Arguments = $" bash {pathToUpdateScript} {pathToUpdateZip}"
}
};
return process;
}
【问题讨论】: