add tunnel program and zotero hookup
This commit is contained in:
parent
08aba1e3d0
commit
0d71058215
2 changed files with 53 additions and 0 deletions
3
bin/run_zotero
Executable file
3
bin/run_zotero
Executable file
|
|
@ -0,0 +1,3 @@
|
|||
#!/bin/bash
|
||||
|
||||
tunnelwrap -i "$HOME/.ssh/id_ed25519" -p 2222 8082:docdav.dav.svc.k8s.barakmich.com:80 barak@barakmich.com "$HOME/local/Zotero_linux-x86_64/zotero"
|
||||
50
bin/tunnelwrap
Executable file
50
bin/tunnelwrap
Executable file
|
|
@ -0,0 +1,50 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
USAGE="Usage: $0 [-p port] <portforward> <hostconnection> <command>"
|
||||
|
||||
if [ $# -lt 2 ]; then
|
||||
echo "$USAGE"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
OPTIND=1
|
||||
PORT=""
|
||||
KEYFILE=""
|
||||
|
||||
while getopts "h?p:i:" opt; do
|
||||
case "$opt" in
|
||||
h|\?)
|
||||
echo "$USAGE"
|
||||
exit 1
|
||||
;;
|
||||
p) PORT=$OPTARG
|
||||
;;
|
||||
i) KEYFILE=$OPTARG
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
shift $((OPTIND-1))
|
||||
|
||||
[ "${1:-}" = "--" ] && shift
|
||||
|
||||
SSH_OPTS=""
|
||||
|
||||
if [ -n "$PORT" ]; then
|
||||
SSH_OPTS="${SSH_OPTS} -p ${PORT}"
|
||||
fi
|
||||
|
||||
if [ -n "$KEYFILE" ]; then
|
||||
SSH_OPTS="${SSH_OPTS} -i ${KEYFILE}"
|
||||
fi
|
||||
|
||||
CONTROLFILE="/tmp/tunnelwrap.$RANDOM"
|
||||
PORTFORWARD="$1"
|
||||
shift
|
||||
HOSTCONNECTION="$1"
|
||||
shift
|
||||
|
||||
ssh -M -S $CONTROLFILE -fnNT -L $PORTFORWARD $SSH_OPTS $HOSTCONNECTION
|
||||
"$@"
|
||||
ssh -S $CONTROLFILE -O exit $HOSTCONNECTION
|
||||
Loading…
Add table
Add a link
Reference in a new issue