diff options
author | Mike Crute <mike@crute.us> | 2020-07-27 18:35:53 +0000 |
---|---|---|
committer | Mike Crute <mike@crute.us> | 2020-07-27 18:36:24 +0000 |
commit | 470e5efcb48b390b2e5ead9325b464de65225530 (patch) | |
tree | ed1417f62900601db9953baae6792bdc050acfc3 /bin | |
parent | c4830900cd56aef6fb63f64a3c001b6a4df498a3 (diff) | |
download | dotfiles-470e5efcb48b390b2e5ead9325b464de65225530.tar.bz2 dotfiles-470e5efcb48b390b2e5ead9325b464de65225530.tar.xz dotfiles-470e5efcb48b390b2e5ead9325b464de65225530.zip |
Add remote bird script and ignores
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/remote-birdc | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/bin/remote-birdc b/bin/remote-birdc new file mode 100755 index 0000000..57d6d39 --- /dev/null +++ b/bin/remote-birdc | |||
@@ -0,0 +1,24 @@ | |||
1 | #/bin/bash | ||
2 | |||
3 | if [ -z "$1" ]; then | ||
4 | echo "usage: $(basename $0) <hostname>" | ||
5 | exit 1 | ||
6 | fi | ||
7 | |||
8 | TD=$(mktemp -d) | ||
9 | |||
10 | trap "rm -rf $TD" EXIT ERR | ||
11 | # Terminal will be in a funky state if we uncleanly exit from birdc | ||
12 | trap "reset; rm -rf $TD" INT TERM | ||
13 | |||
14 | ssh -nNT -oStreamLocalBindUnlink=yes -L $TD/bird.sock:/var/run/bird.ctl $1 > /dev/null 2>&1 & | ||
15 | SSH_PID=$! | ||
16 | |||
17 | sleep 5 | ||
18 | |||
19 | birdc -s $TD/bird.sock | ||
20 | |||
21 | echo "*** Done... cleaning up" | ||
22 | |||
23 | kill -s TERM $SSH_PID >/dev/null 2>&1 | ||
24 | wait $SSH_PID | ||