[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Fab-user] running a process that doesn't return
From: |
Lee Connell |
Subject: |
Re: [Fab-user] running a process that doesn't return |
Date: |
Fri, 10 Jun 2011 08:57:21 -0400 |
Jeff, i am using an init script to start and stop my python program.
I setup my python app to redirect stdout to a log file, this works
fine when i run the python app directly. when i execute the app from
a bash script it does not get redirected to my log file, why would
that be? even if I don't use start-stop-daemon and just run it like
this: /app/python/pyrest.py & it doesn't work
DAEMON=/app/python/pyrest.py
APP_OPTS=''
APP_PID=/app/python/pyrest.pid
APP_CWD=/app/python
APP_PROC=pyrest
case "$1" in
start)
echo "Starting server"
start-stop-daemon --start --background --chdir $APP_CWD
--pidfile $APP_PID --make-pidfile --exec $DAEMON -- $APP_OPTS
;;
stop)
echo "Stopping server"
start-stop-daemon --stop --oknodo --quiet --pidfile $APP_PID
;;
*)
echo "Usage: /etc/init.d/server {start|stop}"
exit 1
;;
esac
exit 0
On Thu, Jun 9, 2011 at 8:25 PM, Jeff Forcier <address@hidden> wrote:
> (CCing the list for posterity, hope you don't mind...)
>
> On Thu, Jun 9, 2011 at 5:20 PM, Lee Connell <address@hidden> wrote:
>> haha, you know I read it AFTER i posted this :) Sorry, got ahead of
>> myself. The nohup example seems to work, i was interested in getting
>> dtach to work so i could reattach to it later. I am using dtach -c
>> /tmp/myapp -z myscript.py but it still hangs.
>
> Unfortunately dtach is one of the related tools I personally have no
> experience with :( All I can say is the core thing is that the process
> needs all its pipes directed away from the shell/pty before the
> wrapping shell session can close cleanly.
>
> Not sure why dtach isn't doing it correctly for you, it's listed in
> the FAQ because other users have reported success using it --
> hopefully one of them will see this and have an idea.
>
> Best,
> Jeff
>
> --
> Jeff Forcier
> Unix sysadmin; Python/Ruby engineer
> http://bitprophet.org
>