chiark
/
gitweb
/
~mdw
/
tunneluser
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
b16ea8b
)
bin/outbound: Factor out the actual shutting down of an SSH process.
author
Mark Wooding
<mdw@distorted.org.uk>
Wed, 6 May 2015 17:04:28 +0000
(18:04 +0100)
committer
Mark Wooding
<mwooding@good.com>
Wed, 6 May 2015 17:04:28 +0000
(18:04 +0100)
bin/outbound
patch
|
blob
|
blame
|
history
diff --git
a/bin/outbound
b/bin/outbound
index cad152660dc5ac315d63ea961574579b995b3b06..5ed160df9c5a425ad10ded7e68ec96b745d19463 100755
(executable)
--- a/
bin/outbound
+++ b/
bin/outbound
@@
-15,12
+15,7
@@
writefile () {
runssh () { ssh -T -oControlPath="./$host.ctrl" "$@"; }
runssh () { ssh -T -oControlPath="./$host.ctrl" "$@"; }
-stopit () {
-
- ## Initial shutdown protocol.
- writefile "$host.state" stopping
- if [ -f "$host.pid" ]; then kill $(cat "$host.pid") 2>/dev/null || :; fi
- rm -f "$host.pid"
+clobber () {
## Shut down an existing connection if there is one.
if [ -S "$host.ctrl" ]; then
## Shut down an existing connection if there is one.
if [ -S "$host.ctrl" ]; then
@@
-39,6
+34,17
@@
stopit () {
## Remove the stale socket.
rm -f "$host.ctrl"
fi
## Remove the stale socket.
rm -f "$host.ctrl"
fi
+}
+
+stopit () {
+
+ ## Initial shutdown protocol.
+ writefile "$host.state" stopping
+ if [ -f "$host.pid" ]; then kill $(cat "$host.pid") 2>/dev/null || :; fi
+ rm -f "$host.pid"
+
+ ## Clobber the existing connection, if there is one.
+ clobber
## Update the state.
rm -f "$host.state" "$host.pid"
## Update the state.
rm -f "$host.state" "$host.pid"