Monit以root身份运行,但是我不想以root启动我的进程。像mysql,mongrel,apache ..
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
(资源)
我find了答案..我可以做一个:start_program =“su -c”命令在这里“USERiWANTtoUSE”.. 🙂
你可以这样做,作为另一个用户运行一个特定的命令
exec /bin/su - userName -c "/usr/bin/nginx start"
这将以您所定义的用户身份运行该命令。 " "
你使用什么操作系统/发行版? 你是如何安装Monit的? 大多数dsitros“做正确的事情”,并确保事情不以root开头。