/sbin/service start jboss
or
/etc/rc.d/init.d/jboss start
When I run either of these commands through capistrano, the server
startup is begun and then terminated when capistrano closes the
connection. It's as if I was issuing a ctrl-c command to the script.
How can I get capistrano to let the service keep running when the
connection is closed?
You'll need to invoke the command via nohup, to ensure the process
will outlive the parent that spawned it. Something like:
run "nohup /sbin/service start jboss"
The drawback of this is that nohup swallows all output of the
command, so you'll not get any feedback of whether the command
actually started or not. :( I've not found a better solution, though.
- Jamis
> You'll need to invoke the command via nohup, to ensure the process
> will outlive the parent that spawned it. Something like:
>
> run "nohup /sbin/service start jboss"
>
> The drawback of this is that nohup swallows all output of the
> command, so you'll not get any feedback of whether the command
> actually started or not. :( I've not found a better solution,
> though.
How about:
run "sh -c \"/sbin/service start jboss &\""
I'm not sure what capistrano magic might prohibit this from working
remotely, but sh(1) should get exec()'d with "/sbin/service..." as an
argument. The ampersand should do its work then and the jboss
process's parent will be init/launchd/etc. You should also see
stdout & stderr.
I do this all the time with sudo, e.g.:
sudo -u mysql sh -c "mysqld_safe &"
-Drew
But why is it that I don't need nohup to start this service (jboss)
when I am running from a logged-in shell? And I don't need to use
nohup in order to start services like mysql using 'run'. They start
just fine as
run "/sbin/service mysql start"
When I try Drew's suggestion below (with or without the &)
sh -c \"/sbin/service jboss start &\"
I see the same problem as before. Only nohup seems to help. I also at
one point had nohup in the script itself on the server and that didn't
seem to work either.
At this point I am happy that things are working and I'm just trying
to figure out where the gaps in my knowledge are. These particular
ones... Perhaps this is too entangled to comprehend.
On Mar 23, 10:18 am, Jamis Buck <j...@37signals.com> wrote:
> Kevin,
>
> You'll need to invoke the command via nohup, to ensure the process
> will outlive the parent that spawned it. Something like:
>
> run "nohup /sbin/service start jboss"
>
> The drawback of this is that nohup swallows all output of the
> command, so you'll not get any feedback of whether the command
> actually started or not. :( I've not found a better solution, though.
>
> - Jamis
>
> On Mar 23, 2007, at 5:40 AM, kevin.gil...@praxeon.com wrote:
>
>
>
>
>
> > I am using the 'run' command to try and start a service (jboss) on a
> > remote machine. The init script is installed and works when executed
> > on the remote machine via
>
> > /sbin/service start jboss
>
> > or
>
> > /etc/rc.d/init.d/jboss start
>
> > When I run either of these commands through capistrano, the server
> > startup is begun and then terminated when capistrano closes the
> > connection. It's as if I was issuing a ctrl-c command to the script.
> > How can I get capistrano to let the service keep running when the
> > connection is closed?- Hide quoted text -
>
> - Show quoted text -