[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: how to kill child process?

From: Sebastian Miele
Subject: Re: how to kill child process?
Date: Sun, 23 Aug 2020 22:31:21 +0200
User-agent: mu4e 1.4.13; emacs 27.1.50

vapnik spaknik <> writes:

>> ssh -S ~/.ssh/%C -N -f remotehost &
>> rsync -au -e "ssh -S ~/.ssh/%C remotehost" remotehost:file1 backupdir/file1
>> rsync -au -e "ssh -S ~/.ssh/%C remotehost" remotehost:file2 backupdir/file2
> and finally, find the pid and kill the ssh session:
>> ps -e|grep ssh
>> kill <PID>

This does not answer your exact question, but such behavior can be
acheived very automatically by putting something like the following into

  ControlMaster auto
  ControlPath ~/.ssh/socket/%C
  ControlPersist 5

This automatically creates master processes.  And the respective master
processes automatically terminate after 5 seconds.  See 'man 5

See "ControlMaster" in 'man 5 ssh_config' for a possible limitation:
"X11 and ssh-agent(1) forwarding is supported over these multi‐ plexed
connections, however the display and agent forwarded will be the one
belonging to the master connection i.e. it is not pos‐ sible to forward
multiple displays or agents."

But even then: ssh seems to have a '-o <option>'.  From 'man 1 ssh':
"This is useful for specifying options for which there is no separate
command-line flag."  So you do not even have to put it into the config
and can use it only on specific commands.

Best wishes

reply via email to

[Prev in Thread] Current Thread [Next in Thread]