Thanks, I will try this out.

On Apr 24, 2006, at 4:27 AM, Nigel King wrote:

>
> I have had trouble with this, see my earlier mail. And I now think the
> problem is with privileges, and which resource is asking for  
> turbogears
> to start.
>
> I have ended up with a little script which starts several turbogears
> services. This sits in my bin directory and is useable once the  
> boot is
> complete. Since the outputs are going to nohup.out there is no need  
> for
> the terminal after this script is done.
>
> Nigel
>
> #!/usr/bin/env python
> """
> Automatically restarts the python processes for turbogears  
> applications
> """
> import commands, os
>
> # list of services required
> servers=[("pathprofiles",8081),
>               ("FamilyTree",8088),
>          ("support",8092)]
>
> def killProcess(ps):
>      s, o = commands.getstatusoutput(ps)
>      o = o.split("\n")
>      for l1 in o:
>          if len(l1)>10:
>              l = l1[:5]
>              print "killing", l, l1
>              s, k = commands.getstatusoutput("kill %s" % l)
>
> # top level directory for turbogears applications
> os.chdir("/Users/nigelk/Documents/PythonScripts/turbogears/trunk")
>
> for f, port in servers[:]:
>      killProcess("ps -aw | grep %s-start.py | grep -v grep | grep -v
> /sw/bin/tracd" % f)
>      # start process using nohup.out as the output terminal
>      os.chdir(f)
>      print os.spawnlp(os.P_NOWAIT,"/usr/bin/nohup", "/usr/bin/nohup",
>                                  "python", "%s-start.py" % f)
>      os.chdir("..")
>      print "restarting %s on port %s" % (f, port)
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~----------~----~----~----~------~----~------~--~---

Reply via email to