check process tomcat with pidfile /var/run/tomcat.pid
start program = "/etc/init.d/tomcat start"
as uid nobody and gid nobody
stop program = "/etc/init.d/tomcat stop"
# You can also use id numbers instead and write:
as uid 99 and with gid 99
if failed port 8080 then restart
(资源)
我找到了答案.. 我可以这样做:start_program = "su -c 'command here' USERiWANTtoUSE".. :)
您可以这样做以作为另一个用户运行特定命令
" "
这将以您定义的用户身份运行该命令您使用的是什么操作系统/发行版?你是如何安装Monit的?大多数 dsitro '做正确的事'并确保事情不会以 root 身份开始。