monit-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [monit-dev] Systemd unit file (also: repo?)


From: Martin Pala
Subject: Re: [monit-dev] Systemd unit file (also: repo?)
Date: Wed, 11 Jan 2012 22:25:32 +0100


On Jan 9, 2012, at 11:10 PM, Maxim Burgerhout wrote:

On Mon, Jan 09, 2012 at 01:55:48PM +0400, Sergey B Kirpichev wrote:
On Mon, Jan 9, 2012 at 3:24 AM, Maxim Burgerhout <address@hidden> wrote:
there is an issue with Monit forking after startup and changing it's PID when
using systemd. The PID file will have the pre-fork PID in it and systemd will
assume the process is exiting (deactivating). well, at least in my tests.

There is NO issue with monit.  Monit uses simple and de-facto standard way
of startup for daemon (as apache or nginx or just anything from /etc/init.d/).

Looking at *your* docs, it seems to be
Type=forking
should solve this "problem" with monit.

It should have been 'forking' indeed, and I tested that when I was writing this
unit file back in October. Back then, I could not get 'forking' to play nice,
which is why I settled for 'simple' in the end. I should have checked the monit
code to see how it implemented forking, but I didn't and made false
assumptions, it seems.

Because of your email, just to be sure, I redid my tests and this time around
it does work. Obviously, I should have done that earlier.

Whether this is due to the version of systemd I used back in October or my, own
failure in testing correctly, I don't know. I must have made some mistake
somewhere.

Long story -> short: I fixed up the unit file (see attachment) and I still hope
the devs are willing to ship this unit file with monit in the future.

Please keep in mind this systemd stuff is new for me, too.


Hi Maxim,

thanks for the monit.service file, we can include it to monit contributions as an template.

According to systemd documentation you should also include the "PIDFile=" option if the type is set to "forking" => something like this should be also added to the service file so systemd will be able to detect if the daemon exited:

PIDFile=/var/run/monit.pid

The systemd documentation also mentions the preference of "simple" type over "forking" - i think monit should work fine with it, you just need to add the "-I" option (capital "i"), so monit won't daemonize (this can be also used when monit is started from traditional sysv init):

ExecStart=/usr/bin/monit -I


Please can you try the following service file? (using simple type with the -I option):

--8<--
[Unit]
Description=Pro-active monitoring utility for unix systems
After=network.target

[Service]
Type=simple
ExecStart=/usr/bin/monit -I
ExecStop=/usr/bin/monit quit
ExecReload=/usr/bin/monit reload

[Install]
WantedBy=multi-user.target
--8<--


Best regards,
Martin



reply via email to

[Prev in Thread] Current Thread [Next in Thread]