Monit does not return error code if state file and id file can not be created

Issue #859 closed
Former user created an issue


i'm integrating monit 5.20.0 on my system. The root filesystem is read-only. The command to launch monit does not return any error status code if the state file and id file can not be created.

/usr/bin/monit -c /etc/monitrcStarting Monit 5.25.2 daemon

Monit start delay set to 240s

echo $?


But the monit process does not exist.

The logs shows me:

monit[19372]: Starting Monit 5.25.2 daemon monit[19372]: Monit start delay set to 240s monit[19374]: State file '/home/root/.monit.state': cannot open for write -- Read-only file system

Now, monit is working fine if I change the path of the files but I report this just for information.

Regards, Sandra Tobajas

Comments (1)

  1. Tildeslash repo owner

    Monit forks. This means that the exit code is from the main process which exits normally and you need to inspect the log to see if there are any errors (in the child process, i.e. the actual Monit process). The exception is if you run Monit with the -I option, then it will not fork and $? will show an error code

  2. Log in to comment