Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix] 修改RcInit运行程序时,针对某些Linux内核,启动必须Sxx开头的服务文件,故创建一个S开头的软链接文件进行启动 #8

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions NewLife.Agent/RcInit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,9 @@ public static Boolean Install(String systemdPath, String serviceName, String bin
// 给予可执行权限
Process.Start("chmod", $"+x {file}");

// 创建同级链接文件 [解决某些linux启动必须以Sxx开头的启动文件]
Process.Start("ln", $"-s {systemdPath}/{serviceName} {systemdPath}/S50{serviceName}");

// 创建链接文件
for (var i = 0; i < 7; i++)
{
Expand All @@ -159,6 +162,10 @@ public override Boolean Remove(String serviceName)
var file = _path.CombinePath($"{serviceName}");
if (File.Exists(file)) File.Delete(file);

// 删除同级链接文件
file = _path.CombinePath($"S50{serviceName}");
if (File.Exists(file)) File.Delete(file);

// 删除链接文件
for (var i = 0; i < 7; i++)
{
Expand Down
Loading