SSH hangs while restarting services
dennylin93 at hs.ntnu.edu.tw
Wed Nov 5 09:22:17 UTC 2014
On Tue, Nov 04, 2014 at 08:48:03AM +0800, Denny Lin wrote:
> Recently I've been trying to restart services remotely using SSH using a
> command instead of entering the shell:
> ssh host "sudo service postgresql restart"
> PostgreSQL is able to restart successfully, but SSH just hangs there
> instead of exiting. I've noticed that this seems to affect any command
> which spawns a child process which doesn't exit.
> Is there any way to get SSH terminate? Thanks.
Sorry, I accidentally deleted the replies in my mailbox, so I'll respond
I've tried running sudo /bin/sh and exiting immediately. There isn't any
hang, so it shouldn't be a sudo bug. I see the same hang over SSH if I
fork a process without sudo.
Adding -f to ssh like Kevin suggested solved the problem. Thanks!
More information about the freebsd-ports