Open JamesMGreene opened 12 years ago
Any update, @kitcambridge? :)
So...here's what I've come up with:
servedir
executable would need to be converted into a wrapper that supports the start
and stop
commands. We can't have multiple servers listening on the same port, so I think we can simplify stop
to accept just a port argument. Both start
and stop
would use the default port if it is not specified.servedir start
would be responsible for starting a new background process (the actual server, launched using require("child_process").fork
), recording its PID (I can't think of a better way of achieving this than a temporary file), then exiting normally. The child process would continue to run in the background and accept connections.servedir stop
would read the PID from the temporary file, then delete the file and kill the child process.Potential problems with this approach:
servedir
's core (I'm particularly uncomfortable with using a temporary file to store the PID). You might be better off implementing this yourself.@kitcambridge: Thanks for the analysis work. I would be inclined to agree that this is probably best left out of servedir
core, rather in favor of a generic Node "ProcMon"/"Task Manager" kind of module. Know of any modules like that?
guys I have implemented what James asked for via chef for polpetta and if you want I can use first argument with polpetta or serverdir so we can use chef for both projects. Right now it's coupled via path.join(__dirname, "polpetta")
but if you put "serverdir" and move chef inside the same folder I believe the logic will simply work as expected. Have a look if you are interested, cheers
Nice. Way to overachieve, @WebReflection. :)
cheers, there's some Windows 7 gotcha in my Atom's based PCrap but with Mac and Linux serverdir is already supported with latest chef ;)
Wanted: Ability to stop servedir instance from command line, with the same basic input combos as the command to start them. For example:
Not 100% sure what the last one would do:
Please consider it. Thanks!