Linux

我如何配置 monit 以啟動特定使用者的程序?

  • September 5, 2016

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

(資源)

我找到了答案.. 我可以這樣做:start_program = “su -c ‘command here’ USERiWANTtoUSE”.. :)

引用自:https://serverfault.com/questions/50628