[Top][All Lists]

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

Re: Monitor processes in the foreground?

From: David Breakey
Subject: Re: Monitor processes in the foreground?
Date: Sat, 07 Sep 2013 10:42:48 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130803 Thunderbird/17.0.8

Except for obvious exceptions (word processors, etc) all processes support running as a daemon, whether they "want" to or not. The only concern is if the process in question expects interaction at the console, in which case other arrangements have to be made to handle I/O. "Daemon" is more a contextual meaning, rather than functional.

I suspect you're getting confused with processes that support "self-detaching" from the current process, so you don't have to explicitly background them.

If you're running on Debian, or any Debian-derived distro, take a look at /etc/init.d/skeleton for a template of a wrapper script that handles pushing something into the background, even when it doesn't "support" it.

This isn't perfect, by any means, but the number of processes that will confound it are reasonably small (a good example of one that won't work as expected is one that launches sub-processes, then kills itself, leaving the spawned processes to handle the actual work, but these seem to be pretty rare).

Sometimes, you need to write a pretty heavily customized wrapper script, which might be more work than it's worth, but I've rarely had to so far (either someone's done it already, or the skeleton is pretty trivially adaptable).

Once you wrap your process in this, then Monit can handle it without problems (well, so long as the PID is properly captured). And even if you can't properly capture the PID, use Monit's pattern matching by process name, instead; not as good as using the PID, but should work well in most cases.

On 09/06/2013 10:35 PM, address@hidden wrote:
Does monit have the ability to start/stop/monitor processes that run in the foreground (they do not support running as a daemon)? If so, can someone point me to an example?


To unsubscribe:

reply via email to

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