I'd like to second the patch -- or functionality like it -- that Folkert van Heusden proposed twelve months ago for the distribution. Without ssh -f returning the pid to the caller, numerous daemon and script monitor packages can't manage ssh, as they can countless other daemons that properly return pid. A monitor needs to record the pids of ssh processes it has started to kill them or to know when they have died. Proper keep alive settings are no use against connections reset by peer.> Hi,Ssh -f forks itself in the background. Very usefull if you would like to e.g. tunnel munin over ssh. Now it's tricky to terminate one process if you have multiple running. It seems that ssh currently (looked at 5.1p1) has no write-pid-to-file functionality So I implemented a patch which do so. Tested it a little and it seems to work. Hopefully it is of any use in my form or inspires the developers to implement this kind of functionality in the ssh distribution. Url: http://www.vanheusden.com/Linux/openssh-5.1p1_writepidfile.diff.gz
On Thu, 4 Feb 2010, Ming wrote:> I'd like to second the patch -- or functionality like it -- that > Folkert van Heusden proposed twelve months ago for the distribution. > > Without ssh -f returning the pid to the caller, numerous daemon and > script monitor packages can't manage ssh, as they can countless other > daemons that properly return pid. A monitor needs to record the pids > of ssh processes it has started to kill them or to know when they have > died. Proper keep alive settings are no use against connections reset > by peer.It isn't necessary. You can tear down ssh connections from the control socket and learn the PID of a running SSH, see the commands listed under -O in ssh(1). -d