[Planetlab-devel] a patch for smoother remote control of a myplc

Thierry Parmentelat Thierry.Parmentelat at sophia.inria.fr
Mon Jun 18 07:16:10 EDT 2007


Hi

For the record, I'd like to document a patch that I've done in myplc
This is no really serious issue, but it was really sneaky and I had such 
a hard time figuring it out that I thought it was worth describing here

The context is, we are trying to put together a rustic testbed for 
checking minimal functionality of our dayly build. For that purpose we 
use a 'master' test machine that is likely to install/upgrade and 
API-control one or several myplc's. (The reason why we chose this 
external master mode, as opposed to an 'all-in-one-box' approach, is 
that we actually built up from the federation test scripts that require 
at least two instances of myplc.)

Anyway the symptom is, if in a similar context you run something like
$ ssh root at myplcbox service plc start httpd
then everything runs fine, except that this command stupidly hangs and 
never returns.

The reason for this beahaviour is that the forked httpd is started with 
file descriptors 3 and 4 opened by the guest.init script - this is part 
of the trick used by guest.init to produce a clean output.

Here is the fix  -- Thierry

$ svn diff -r544:545 plc.d/functions
Index: plc.d/functions
===================================================================
--- plc.d/functions     (revision 544)
+++ plc.d/functions     (revision 545)
@@ -56,7 +56,16 @@
     [ -n "${pid:-}" -a -z "${force:-}" ] && return
 
     # And start it up.
-    (exec -a plc_${base} $*)
+    (exec 3>&- 4>&- ; exec -a plc_${base} $*)
     ret=$?
 
     if [ -f /var/run/${base}.pid ] ; then



More information about the Devel mailing list