Jof*_*off 11 linux systemd monit
我喜欢将 monit 用于 Web 界面,在那里我可以看到正在运行的受监控进程。我最近将服务器升级到 Ubuntu 16.04,它正在使用 systemd。
我有其他一切都在运行,但我找不到正确的 monit 命令来控制 systemd...
我曾经做过/etc/init.d/process start或stop或其他什么。这显然不再有效,所以我尝试了......
systemctl start process这也不起作用。我能在这里做什么?我的 monitrc 粘贴在下面......(在 14.04 上工作的旧样式)
check process nginx with pidfile /var/run/nginx.pid
start program = "/etc/init.d/nginx start"
stop program = "/etc/init.d/nginx stop"
check process sshd with pidfile /var/run/sshd.pid
start program = "etc/init.d/ssh start"
stop program = "etc/init.d/ssh stop"
Run Code Online (Sandbox Code Playgroud)
小智 11
这应该适用于 RHEL / CentOS 7 / Ubuntu 18.04
check process nginx with pidfile /var/run/nginx.pid
start program = "/bin/systemctl start nginx"
stop program = "/bin/systemctl stop nginx"
check process sshd with pidfile /var/run/sshd.pid
start program = "/bin/systemctl start sshd"
stop program = "/bin/systemctl stop sshd"
Run Code Online (Sandbox Code Playgroud)
小智 0
在 Ubuntu 16 或更高版本上,您可以使用 systemctl 然后启动或停止服务:
check process nginx with pidfile /var/run/nginx.pid
start program = "systemctl start nginx"
stop program = "systemctl stop nginx"
check process sshd with pidfile /var/run/sshd.pid
start program = "systemctl start sshd"
stop program = "systemctl stop sshd"
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
7281 次 |
| 最近记录: |