Alberto Valverde schrieb:
>
> On Feb 16, 2007, at 11:29 PM, Richard Harding wrote:
>
>> Christopher Arndt wrote:
>>> ---- 8< ----
>>> #!/bin/bash
>>>
>>> cd "${0%/*}"
>>> exec ./start-myapp.py ${1:-prod.cfg}
>>> ---- >8 ----
>> Thanks for the bit of bash. That's working great. I'm going to work
>> on a
>> wiki/blog post about the stuff required to get this to run. Can I use
>> that as a recommended method of running the app?
>
> I's usually not a good idea to run daemons with a working directory
> other than "/" because that would prevent unmounting the filesystem
> the app is rooted at during server mainteinance.
Yes, the Right Thing to do would be to run your server in / and hardcode every
path your app needs as an absolute path or figure it out dynamically.
For example, if you were using a sqlite database file, which should live in
the 'data' directory below the directory where your start script lives, you
could do the following in the start-script:
---- >8 ----
import sys
from os.path import abspath, dirname, join
script_dir = abspath(dirname(sys.argv[0])
db_file = join(script_dir, 'data', 'data.sqlite')
db_uri = 'sqlite://%s' % db_file
config.update({'global': {'sqlobject.dburi': db_uri}})
---- >8 ----
I haven't tried to set the log file locations in this way yet, but the same
principle should apply.
Chris
--~--~---------~--~----~------------~-------~--~----~
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?hl=en
-~----------~----~----~----~------~----~------~--~---