How i configure monit to start a process with a specific user?

26,733

Solution 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

(source)

Solution 2

i have found a answer.. i could do a: start_program = "su -c 'command here' USERiWANTtoUSE".. :)

Share:
26,733

Related videos on Youtube

Guilherme
Author by

Guilherme

Updated on September 17, 2022

Comments

  • Guilherme
    Guilherme over 1 year

    Monit runs with root, but i don't want to start my processes as root.. like mysql, mongrel, apache..

  • Guilherme
    Guilherme almost 15 years
    or can use a option 'as uid USERNAME and gid GROUPNAME'. For ex: start_program = "command" as uid USER and gid GROUPNAME
  • Guilherme
    Guilherme almost 15 years
    i'm using debian sarge.. i've installed with apt-get.. i don't think monit can be started as other user than root.. by the way it can?.. :)
  • shingara
    shingara about 14 years
    it's better if you edit your answers with this information.
  • b3m2a1
    b3m2a1 almost 12 years
    monit can be run by any user with monit -c .monitrc