Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/c/62.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
即使在centos 7.3中不存在ExecStart进程后,Systemd服务状态仍保持运行_C_Linux_Linux Kernel_Centos7 - Fatal编程技术网

即使在centos 7.3中不存在ExecStart进程后,Systemd服务状态仍保持运行

即使在centos 7.3中不存在ExecStart进程后,Systemd服务状态仍保持运行,c,linux,linux-kernel,centos7,C,Linux,Linux Kernel,Centos7,我已经创建了一个systemd服务,就像任何中断触发到运行的进程一样,然后它必须重新启动自己。但即使在进程退出之后(在exec_start中提到),服务也会显示其运行状态(使用systemctl status x.service)。 下面是我的服务脚本 { } /opt/bin/xserver是一个具有777权限的C可执行文件。为SIGINT和SIGSEGV添加了信号处理程序。SIGINT是指从用户处正确退出。SIGSEGV将日志回溯到我们的自定义日志文件。每当进程接收到这些信号时,它就会退出

我已经创建了一个systemd服务,就像任何中断触发到运行的进程一样,然后它必须重新启动自己。但即使在进程退出之后(在exec_start中提到),服务也会显示其运行状态(使用systemctl status x.service)。 下面是我的服务脚本

{

}

/opt/bin/xserver是一个具有777权限的C可执行文件。为SIGINT和SIGSEGV添加了信号处理程序。SIGINT是指从用户处正确退出。SIGSEGV将日志回溯到我们的自定义日志文件。每当进程接收到这些信号时,它就会退出 {
退出(退出失败)

}

对于
Type=forking
,systemd假设start命令的子进程或子进程的子进程是守护进程


如果守护进程不按此方式运行,请将其更改为
simple

对于
Type=forking
,系统将假定start命令的子进程或子进程的子进程是守护进程

如果守护进程没有按此方式运行,请将其更改为
simple

[Unit]
Description=xserverd
After=syslog.target rsyslog-x.service systemd-modules-load.service
Requires=rsyslog-x.service systemd-modules-load.service
[Service]
Type=forking
ExecStart=/opt/bin/xserver
Restart=always
RestartSec=2s
RemainAfterExit=no
RestartPreventExitStatus=SIGINT
KillMode=process
TimeoutSec=300s
[Install]
WantedBy=multi-user.target