diff options
author | David Runge <dave@sleepmap.de> | 2015-06-27 14:26:14 +0200 |
---|---|---|
committer | David Runge <dave@sleepmap.de> | 2015-06-27 14:26:14 +0200 |
commit | 31f2e1b25b593b3c935518151774d23358f3a20f (patch) | |
tree | 2277943b1d2dac77d385b297130519d7993fdbf1 /scripts | |
parent | 68af516777af8f559d5853f28f4ecbe52735dd8a (diff) | |
parent | cae71ea147acd1a6a7751ad9c2a0a6e3f7f9e651 (diff) | |
download | uenv-31f2e1b25b593b3c935518151774d23358f3a20f.tar.gz uenv-31f2e1b25b593b3c935518151774d23358f3a20f.tar.bz2 uenv-31f2e1b25b593b3c935518151774d23358f3a20f.tar.xz uenv-31f2e1b25b593b3c935518151774d23358f3a20f.zip |
Merge branch 'master' of sleepmap.de:uenv
* 'master' of sleepmap.de:uenv:
scripts/autotunnel: Fixing SERVER_ALIVE_COUNT_MAX
system/autotunnel@.service: Fixing script name.
autotunnel: Adding example config, systemd service file and script for autossh managed SSH tunnel to predefined host
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/autotunnel | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/scripts/autotunnel b/scripts/autotunnel new file mode 100755 index 0000000..2a1f17b --- /dev/null +++ b/scripts/autotunnel @@ -0,0 +1,21 @@ +#!/usr/bin/env bash + +if [ -z "$SERVER_ALIVE_INTERVAL" ];then + SERVER_ALIVE_INTERVAL=45 +fi + +if [ -z "$SERVER_ALIVE_COUNT_MAX" ];then + SERVER_ALIVE_COUNT_MAX=2 +fi + +if [ -z "$MONITORING_PORT" ];then + MONITORING_PORT=0 +fi + +/usr/bin/autossh -M "$MONITORING_PORT" \ + -NCTv \ + -o ServerAliveInterval="$SERVER_ALIVE_INTERVAL" \ + -o ServerAliveCountMax="$SERVER_ALIVE_COUNT_MAX" \ + -o TCPKeepAlive=yes \ + -w $TUN_DEVICE:$TUN_DEVICE \ + $HOST |