[Top][All Lists]

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

Re: Monit believes process failed when it didn't

From: Lutz Mader
Subject: Re: Monit believes process failed when it didn't
Date: Fri, 4 Dec 2020 22:01:54 +0100
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:60.0) Gecko/20100101 Thunderbird/60.4.0

Hello Eric,
you can not use scripts are running in an infinite loop.
The script must spawn or you wrapper script should do this.

> I have a (legacy) shell script that I need to call from monit.  This shell
> script runs an infinite loop.

A good source are the scripts used with systemd or initd.

Unfortunalely, there is no general way to create an useful script, but
the script should not quit immediately. To start Jetty I use something
like the following, without any sleep.

case "$1" in
        cd "${DIR}/jetty"
        $PRG status
        if [ $? -ne $ONLINE ]; then
#          export TZ=Europe/Berlin
          export TZ=MEZ-1MESZ,M3.5.0,M10.5.0
          export PATH=${DIR}/Java/jre8/bin:$PATH
          export JAVA_HOME=${DIR}/Java/jre8
#          export JETTY_BASE=${DIR}/jetty
          export JETTY_HOME=${DIR}/jetty

          nohup java -jar $JETTY_HOME/start.jar >> $LOGFILE 2>&1 &
          echo $! > $PIDFILE

But for some scripts are spawning itself I use a sleep too for some
other not. The answer to your problem, it depends.

with regards,

reply via email to

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