If you run Monit as root, you can set the uid/gid for exec actions and 
start/stop/restart programs ... Monit will then execute them as the specified 
user, not as root. If you want to run the tests as specific user too, you have 
to start Monit as that user. You can also run multiple Monit instances on the 
same machine (different users - different monits) - in such case you need to 
customize monit files locations using "set pidfile", "set statefile", "set 
idfile" statements).


On 01 Oct 2014, at 22:53, Tim Uckun <[email protected]> wrote:

> Can monit be instructed to run the config file as a specified user?
> 
> On Wed, Oct 1, 2014 at 10:09 PM, Martin Pala <[email protected]> wrote:
> You can use the "include" statement:
> 
>         include /usr/local/monit.d/*
> 
> If you'll split the configuration for the deployed processes to one file per 
> process, you'll be to add/remove these include files automatically. You can 
> also add check for the "include" directory timestamp ... each time you 
> add/remove file from the directory, its mtime is updated, which you can use 
> to reload monit automatically:
> 
>         check directory monit_includes with path /usr/local/monit.d/
>                 if changed timestamp then exec "/sbin/restart monit"
> 
> Note that if you'll have syntax error in new include file, monit restart 
> attempt will kill it, as it will hit the syntax error => in the above exec 
> action it'll be safer to use some simple script which will restart monit 
> conditionally - check the syntax first (using "monit -t") and restart only if 
> there are no problems, otherwise keep running and/or fire alarm.
> 
> Regards,
> Martin
> 
> 
> On 01 Oct 2014, at 00:51, Tim Uckun <[email protected]> wrote:
> 
> > I have the following scenario.
> >
> > We have multiple web apps owned by the deploy user  and running as the web 
> > user.  I would like monit to check each app directory for a monit.conf file 
> > (app/config/monit.conf) and process it as the deploy user.  When a new app 
> > is deployed I would like monit to notice this and run the config file. When 
> > an app is removed I would like monit to notice this and kill the processes 
> > started by that app (this is probably too much to ask).
> >
> > Obviously running monit via the users cron would do this but I am wondering 
> > if it's possible to do this using the daemon mode.
> >
> > Cheers.
> > --
> > To unsubscribe:
> > https://lists.nongnu.org/mailman/listinfo/monit-general
> 
> 
> --
> To unsubscribe:
> https://lists.nongnu.org/mailman/listinfo/monit-general
> 
> --
> To unsubscribe:
> https://lists.nongnu.org/mailman/listinfo/monit-general

--
To unsubscribe:
https://lists.nongnu.org/mailman/listinfo/monit-general

Reply via email to