monit-general
[Top][All Lists]
Advanced

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

Re: How to prevent monit from auto -restarting process


From: sven falempin
Subject: Re: How to prevent monit from auto -restarting process
Date: Wed, 6 Nov 2013 09:37:11 -0500

maybe 

<<for X cycles then stop>>


On Wed, Nov 6, 2013 at 9:26 AM, Josh Blancett <address@hidden> wrote:
you can also say `monit unmonitor [service]`  which pretty much does exactly what it sounds like.


On Wed, Nov 6, 2013 at 3:30 AM, Roose, Marco <address@hidden> wrote:
Hi Vicky,
the first point is something I thought about a while before. I think there is no easy solution because the "machine" does not know if the service crashed or was canceled. The only thing you could do form my opinion is to extend the init-script of the service with something which sets a system wide variable which is visible for monit (just as how I would try to do it in principle for the monit init script):

case "$1" in
        start)
                echo -n "Starting monit "

        ### RESET THE MANULA FLAG ####
        if test "yes" = "${ monit_stop_manual }"; then
                export monit_stop_manual = ""
        fi

                if test "yes" = "${MONIT_VIA_INITTAB}"; then
                        echo "via /etc/inittab"
                        "${MONIT_MODIFY_INITTAB}" --add && echo -en "${esc}[1A"
                else
            PID_DIR=$(/bin/basename "$MONIT_PID_FILE")
            /bin/mkdir -p -m0700 "$PID_DIR"
                        checkproc -p "${MONIT_PID_FILE}" "${MONIT_BIN}" && \
                                echo -n " Warning: monit already running. "
                        startproc -p "${MONIT_PID_FILE}" "${MONIT_BIN}" -c "${MONIT_RC_FILE}" ${MONIT_ARGS}
                fi
                rc_status -v
                test $? -eq 0 && touch "${MONIT_SUBSYS_FILE}"
                ;;
        stop)
                echo -n "Shutting down monit "
        ### FLAG IF THE SERVICE WAS STOPED MANUAL ###
        export monit_stop_manual = "yes"

                if test "yes" = "${MONIT_VIA_INITTAB}"; then
                        echo "from /etc/inittab"
                        "${MONIT_MODIFY_INITTAB}" --remove && echo -en "${esc}[1A"
                else
                        checkproc -p "${MONIT_PID_FILE}" "${MONIT_BIN}" || \
                                echo -n " Warning: monit not running. "
                        killproc -p "${MONIT_PID_FILE}" "${MONIT_BIN}"
                fi
                rc_status -v
                test $? -eq 0 && rm -f "${MONIT_SUBSYS_FILE}"
                ;;

If this exists you should be able to use it in your monit configuration (how to this maybe should answered by the monit team with a fully working solution ;-)

Best regards,
Dr. Marco Roose

-----Original Message-----
From: monit-general-bounces+marco.roose=address@hidden [mailto:monit-general-bounces+marco.roose=address@hidden] On Behalf Of Gonzalez, Victoria
Sent: Wednesday, November 06, 2013 2:20 AM
To: This is the general mailing list for monit
Subject: How to prevent monit from auto -restarting process

Hi all,

I have been looking through archive and I still have a couple of questions.

1. If there a why to prevent monit from auto restarting a process that has been manually stopped?

2. when monit is install for the first time, it fails the first time, but succeeds the on the following starts.  Is there a setting or file that is needed intially?

Thanks,
~Vicky

--
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



--
---------------------------------------------------------------------------------------------------------------------
() ascii ribbon campaign - against html e-mail 
/\ 

reply via email to

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