|Think about Loose Coupling|
Launching a launcher?by pileofrogs (Priest)
|on Aug 27, 2010 at 23:09 UTC||Need Help??|
pileofrogs has asked for the
wisdom of the Perl Monks concerning the following question:
I'm on CentOS linux and I'm writing a script to start important services if they get turned off for some reason. The services in question are all launched by bash scripts on system start, so I'm going to call those same scripts to start dead services.
My problem is, one of those scripts starts its process and puts it in the background by running a foreground process with a '&' at the end. This seems to be keeping the filehandles open and perl doesn't recognise that the launcher (not the service) has ended. Obviously, I should fix that launcher to be better behaved, but I want my perl script to be able to handle badly written launchers.
I'll try and show an example in case that didn't make sense... I'm starting an imaginary server called "crappyserver".
Here's an example launcher /etc/rc.d/init.d/crappyserver
And here's my launcher launcher
My launcher-launcher hangs at the open() call. It does launch crappyserver, but it never prints "Done!"
This has something to do with buffering doesn't it...?
Any help is greatly appriciated!