Thanks Jan - this looks quite useful. The Fabric faq did mention daemonizing the process to be detached and this gives me an easy way to do that.

Pat

On 8/24/2011 11:20 PM, Jan Vlčinský (CAD) wrote:
Hi
I would try zdaemon script, http://pypi.python.org/pypi/zdaemon/2.0.4
I use it to turn my python scripts into services on Linux and like the comfort of

 1. creation of start/stop/status/showrelog/restart script in just a
    few lines
 2. direct command like "mydeamonizedscript start"
 3. interactive console to do all the actions
 4. option to check content of the running log file.

For your use case, I would check, what is returned result code and set zdaemon so that it does not restart the script, if it returns expected status code.

for more, see http://ridingpython.blogspot.com/2011/08/turning-your-python-script-into-linux.html
Jan
*Ing. Jan Vlčinský*
CAD programy
Slunečnicová 338/3, 734 01 Karviná Ráj, Czech Republic
tel: +420-597 602 024; mob: +420-608 979 040
skype: janvlcinsky; GoogleTalk: [email protected] <mailto:[email protected]>
http://cz.linkedin.com/in/vlcinsky



On 25 August 2011 05:31, pat flaherty <[email protected] <mailto:[email protected]>> wrote:

    Hi,

    I'm using fabric to populate eucalyptus instances in a private
    cloud with company 'client' programs (that then communicate back
    to my server) - and hopefully the last thing fabric does before
    detaching is startup one of these client programs.  However it
    needs to leave the remote client process detached and running as
    fab exits.

    I'd solved an earlier fab detach process problem with

    run('... command ...',pty=False)

    for a tomcat app server and this worked fine.

    This time I have to leave detached a 'grinder' agent process:

    http://grinder.sourceforge.net/index.html

    The grinder is test automation software.

    In particular this is the (grinder) command I want to issue as the
    last statement in my fab routine before fab detaches and exits:

    java net.grinder.Grinder

    you run this in a particular directory (use 'with cd' in fabric)
    with files configged in certain and the agent/client program
    attaches itself to the grinder console (remotely) and you control
    the running  of multiple agents of the same kind from the grinder
    console.

    Anyway, this process won't detach.  pyt=False doesn't work and I
    also tried the solutions from here:

    http://fabric.readthedocs.org/en/latest/faq.html

    which include pty=False in addition to such things as this:

    run("nohup yes >& /dev/null < /dev/null &")

    but so far, no luck.

    Any ideas welcome.

    Pat


    _______________________________________________
    Fab-user mailing list
    [email protected] <mailto:[email protected]>
    https://lists.nongnu.org/mailman/listinfo/fab-user



_______________________________________________
Fab-user mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/fab-user

Reply via email to