diff --git a/.bashrc b/.bashrc index c025c9ee382bb0c2a6a74a1001d305f2c37d0079..9e968d55c5b62ed1f39b0a95e4972c8233e1f77a 100644 --- a/.bashrc +++ b/.bashrc @@ -293,11 +293,14 @@ flatpak_kill () { fi } -__prune_docker_remote () { - for i in ~/.ssh/docker_* - do - [ ! -e "$i" ] || lsof -t "$i" >/dev/null || rm "$i" - done +# shellcheck disable=SC2120 +prune_ssh_sockets () { + ( [ "${1:-}" != '-f' ] && [ "${1:-}" != '--force' ] ) || killall -v ssh || true + find ~/.ssh/ \ + -maxdepth 1 \ + -type s \ + \! -name 'cm_*.sock' \ + -execdir sh -c 'lsof -t "$1" >/dev/null || rm "$1"' _ {} \; } __prompt () { @@ -383,4 +386,5 @@ then ! command -v direnv > /dev/null || eval "$(direnv hook bash)" fi -__prune_docker_remote +# shellcheck disable=SC2119 +prune_ssh_sockets diff --git a/.ssh/config.d/20_endless b/.ssh/config.d/20_endless index 7c260273c6d55d6e4b942bd50b31dac4da1c7f06..068810dc5472b976c494584c9b5a0bc7698ade81 100644 --- a/.ssh/config.d/20_endless +++ b/.ssh/config.d/20_endless @@ -1,4 +1,5 @@ +# vim:ft=sshconfig #Endless Host appupdates.endlessm.com irc.endlessm.com status.endlessm.com diff --git a/.ssh/config.d/20_github b/.ssh/config.d/20_github index 198ef69bb5a539798ff056acd5bdfe8fe2e9b776..d6f9e06d0aba84845adbcea4c3e0010d6e3406aa 100644 --- a/.ssh/config.d/20_github +++ b/.ssh/config.d/20_github @@ -1,3 +1,5 @@ + +# vim:ft=sshconfig # github.com Host github.com diff --git a/.ssh/config.d/20_shore b/.ssh/config.d/20_shore index cd1fadd123ab4a92bf638fe35bf7f1a0404d87b7..7ea02c9189f22d75b4cf3d522bca17f450bdea54 100644 --- a/.ssh/config.d/20_shore +++ b/.ssh/config.d/20_shore @@ -1,4 +1,5 @@ +# vim:ft=sshconfig # shore.co.il infrastructure Host cgit.shore.co.il host01.shore.co.il wdr4300.shore.co.il xbmc.shore.co.il diff --git a/.ssh/config.d/30_localhost b/.ssh/config.d/30_localhost index 8c88ab9cb0828081a6a6498c118ece1bcaf4141e..e290116f3015c0ae5206688e342c191f43ffd2d8 100644 --- a/.ssh/config.d/30_localhost +++ b/.ssh/config.d/30_localhost @@ -1,4 +1,5 @@ +# vim:ft=sshconfig # localhost Host localhost diff --git a/.ssh/config.d/90_ec2 b/.ssh/config.d/90_ec2 index 6b7ed8a471b766b3ce469bd4e9b2a27a9ddd90a8..2e3df2482433fb6c300f64a0dbac64cb7e521f76 100644 --- a/.ssh/config.d/90_ec2 +++ b/.ssh/config.d/90_ec2 @@ -1,4 +1,5 @@ +# vim:ft=sshconfig # Disable SSH host key checking for EC2 instances. Host *.compute-1.amazonaws.com diff --git a/Documents/bin/forward b/Documents/bin/forward index a75ecd7bd965bc88081430397dcac68c26a70326..d14272abeeeb3ed04a11f33512e35a422d6cc74b 100755 --- a/Documents/bin/forward +++ b/Documents/bin/forward @@ -7,7 +7,7 @@ usage () { host="$1" || { usage >&2; exit 1; } forward="$2" || { usage >&2; exit 1; } -alias ssh='ssh -fnNTS ~/.ssh/%C.sock' +alias ssh='ssh -fnNTS ~/.ssh/cm_%C.sock' # shellcheck disable=SC2029 ssh -o ControlMaster=auto \