monit-general
[Top][All Lists]
Advanced

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

Re: [monit] Using monit to monitor irexec


From: Martin Pala
Subject: Re: [monit] Using monit to monitor irexec
Date: Mon, 12 Oct 2009 23:06:52 +0200

When the same script runs fine from command line, the problem will be most probably environment variables. Monit purges environment variables for security reasons and sets spartan PATH only (to /bin, / usr/bin, /sbin, /usr/sbin) as described here:
http://mmonit.com/wiki/Monit/FAQ#execution

In your script you use few non-fully qualified program paths such as "killall" and "pgrep" ... it is possible that some of these programs isn't in PATH which is given to the program => can be fixed by providing full path in script. Another possible problem could be if irexec needs some environment variable which is not passed to the program and needs to be set in script explicitly too.

Martin

On Oct 10, 2009, at 8:12 AM, John H wrote:

I'm trying to use monit to monitor irexec but I cannot figure out
where I'm going wrong. I use monit for mythbackend and it works well.
The problem I have is sometimes irexec just dies and I want something
to restart this automatically. Irexec doesn't create a pid file so I
had to do this so from there I added the irexec to my monitrc file. I
also wrote a script to start irexec and this always comes back as fail
when trying to start irexec. Yet I can run the command from the
command line.

Here's the start script

#!/bin/sh

# let's remove the current pid file since it's a start
if [ -f /var/run/irexec/irexec.pid ]; then
rm /var/run/irexec/irexec.pid
fi

#mkdir for the pid file
mkdir -p /var/run/irexec
chown mythtv /var/run/irexec

#killall irexec processes
killall irexec
sleep 1
DISPLAY=:0 /usr/bin/irexec -d /home/mythtv/.lircrc
sleep 1
#create new pid file
pgrep irexec > /var/run/irexec/irexec.pid

exit 0

irexec runs as a user so in my monitrc file I have this to run as mythtv

I thought my irexec command issue was a display issue so I added the
display in the front but this didn't solve the problem.

To stop irexec, I just have a killall command running as root.

Can someone point me in the right direction?


--
To unsubscribe:
http://lists.nongnu.org/mailman/listinfo/monit-general





reply via email to

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