我正在使用 Debian 9.8
我有一个运行我的 dotnet 程序的服务。我想用 monit 监视它,但在所有示例中,您都需要在 /var/run 中引用 .pid 文件,但我的 dotnet 程序在 /var/run 中没有 .pid 文件。
所以我将 PIDFile=/var/run/testservice.pid 添加到我的服务的 .service 文件中,但是当我启动它时它没有创建文件。
这就是我所在的地方
这是我的 .service 文件
[Unit]
Description=Test Service
Wants=network-online.target influxdb.service
After=network-online.target influxdb.service
[Service]
User=testservice
Group=mainapp
SyslogIdentifier=testservice
PIDFile=/var/run/testservice.pid
Restart=on-failure
TimeoutStopSec=5
RestartSec=10
ExecStart=/usr/bin/dotnet /mainapp/app/TestSystemdService.dll
[Install]
WantedBy=multi-user.target
Run Code Online (Sandbox Code Playgroud)