Monit 以 root 身份运行,但我不想以 root 身份启动我的进程..例如 mysql、mongrel、apache..
答案1
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
答案2
我找到了答案..我可以这样做:start_program =“su -c'command here'USERiWANTtoUSE”.. :)
答案3
您可以执行此操作以另一个用户身份运行特定命令
exec /bin/su - userName -c "/usr/bin/nginx start"
这将以" "
你定义的用户身份运行该命令
答案4
您使用的是什么操作系统/发行版?您是如何安装 Monit 的?大多数 dsitros 都会“做正确的事”,并确保不会以 root 身份启动。