Per-service working directory setting in config

Issue #807 on hold
Michał Begejowicz created an issue

Hello!

I have a question/proposition about the working directory for executing commands. It seems there is some code in place:

https://bitbucket.org/tildeslash/monit/src/f8ab18fcc87878fb06c433a3807d7b28fe40ea59/libmonit/src/system/Command.c#lines-506:512

which changes workdir to one specified in Command, but I'm unable to find any usages of Command_setDir , which should safely set the working directory field; I don't see any mention of such setting in documentation either.

Provided I haven't missed it, I think it would be quite useful to have an option to set working directory for start/stop scripts. It seems to be quite common request, and there is some code which seems to handle that already :)

If it's not an option, I found some unused code then, which is also nice.

Thanks!

Comments (1)

  1. Tildeslash repo owner

    The code you mention does indeed change the working directory for a process started by Monit. It is also true that it is currently not used.

    On startup, Monit set its working directory to / The reason is that Monit could otherwise prevent unmounting of filesystems if it change into an arbitrary directory.

    I think this is the best strategy for a program like Monit which runs all the time. But we are open to arguments for doing as you suggest.

  2. Log in to comment