Cfengine configuration directory

Processes and shellcommands never exit

Relevant classes: any

General tip:
Try:

 "shellcommand < /den/null > /dev/null 2>&1"

To make sure all descriptors are closed in your scripts.
Also:
I've been experiencing the process restart hang under Gentoo linux for
all of the init scripts, and have found a novel workaround I thought
I'd share in case someone else has the problem.

Past posts have indicated that the daemon itself is at fault, and if
the useshell options weren't helping, the only way to correct the
issue was to fix the daemon. 

Past post:
http://www.geocrawler.com/archives/3/374/2000/1/0/3068970/

The workaround involves explicitly using a shell, and then forcing the
shell to exit regardless of open files left by the daemon.

Here's a sample entry for syslog-ng under Gentoo:

processes:
   "/usr/sbin/syslog-ng"
      restart "/etc/init.d/syslog-ng zap start 2<&-"
      matches=1
      useshell=true

The key is "2<&-" which forces stderr to close, freeing the shell to
exit. A more severe option is to use "0<&- 1<&- 2<&-" forcing stdin,
stdout, and stderr to close. Closing stdin is sufficient to kill the
shell under normal circumstances.

Link to Gentoo Forums posts:
http://forums.gentoo.org/viewtopic.php?t=87904&highlight=

Enjoy!

Russell
Russell Adams 

Back to documentation