From c45879d6848b625330537a04618579c097450d77 Mon Sep 17 00:00:00 2001 From: Tzafrir Cohen Date: Wed, 6 Oct 2010 13:22:50 +0000 Subject: rapid-tunneling: -D: don't daemonize. * An option to not run the process in the background. Also useful for running under upstart and such. * Update man page for recent changes. git-svn-id: svn+ssh://xorcom/home/svn/debs/components/rapid-tunneling@8441 283159da-0705-0410-b60c-f2062b4bb6ad --- rapid-tunneling | 13 +++++++++++-- rapid-tunneling.8 | 12 +++++++++--- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/rapid-tunneling b/rapid-tunneling index f015960..a7ff91f 100755 --- a/rapid-tunneling +++ b/rapid-tunneling @@ -11,6 +11,7 @@ usage() { echo >&2 " $me [options] remote-access-NAME.tar.gz" echo >&2 "" echo >&2 "Options:" + echo >&2 " -D Don't daemonize" echo >&2 " -h HOST Connect to HOST rather the host from the tarball" echo >&2 " -p PORT Connect to PORT rather the host from the tarball" echo >&2 " -u USER Connect to USER rather the host from the tarball" @@ -27,9 +28,12 @@ if [ -r /etc/rapid-tunneling/client ]; then . /etc/rapid-tunneling/client; fi opt_host='' opt_port='' opt_user='' +opt_daemonize='yes' -while getopts b:h:p:u: opt; do +while getopts dDh:p:u: opt; do case "$opt" in + D) opt_daemonize='no';; + d) opt_daemonize='yes';; h) opt_host="$OPTARG";; p) opt_port="$OPTARG";; u) opt_user="$OPTARG";; @@ -67,5 +71,10 @@ if [ -x /sbin/start-stop-daemon ]; then else SSD="/sbin/busybox start-stop-daemon" fi +if [ "$opt_daemonize" = 'yes' ]; then + SSD_CMD="$SSD -S -b -m -p $base_dir/pid -x /bin/sh -- -c" +else + SSD_CMD="/bin/sh -c" +fi -$SSD -S -b -m -p $base_dir/pid -x /bin/sh -- -c "exec env SSH_AUTH_SOCK= ssh -o 'StrictHostKeyChecking no' -o 'BatchMode yes' -o 'ServerAliveInterval 60' -T -p $port -i $base_dir/key -R $tunnelport:127.0.0.1:22 -l $user $host < $base_dir/ra-params.tar.gz" +$SSD_CMD "exec env SSH_AUTH_SOCK= ssh -o 'StrictHostKeyChecking no' -o 'BatchMode yes' -o 'ServerAliveInterval 60' -T -p $port -i $base_dir/key -R $tunnelport:127.0.0.1:22 -l $user $host < $base_dir/ra-params.tar.gz" diff --git a/rapid-tunneling.8 b/rapid-tunneling.8 index ffe794f..b3463b8 100644 --- a/rapid-tunneling.8 +++ b/rapid-tunneling.8 @@ -1,4 +1,4 @@ -.TH RAPID-TUNNELING 8 "2009-03-04" +.TH RAPID-TUNNELING 8 "2010-10-06" .SH NAME rapid-tunneling \- Initiate a RapidTunneling tunnel .SH SYNOPSIS @@ -31,7 +31,13 @@ allow the operator of the remote server to connect locally. The following options allow you to override settings from the tarball with your own. -.B -p \fIhost\fR +.B -D +.RS +Stay in the background and don't daemonize. Useful when running under a monitor +process (upstart, systemd) or for debugging. +.RE + +.B -h \fIhost\fR .RS Overide the SSH host name of the server. .RE @@ -41,7 +47,7 @@ Overide the SSH host name of the server. Overide the SSH port number of the server. .RE -.B -p \fIuser\fR +.B -u \fIuser\fR .RS Overide the SSH username to use. Normally should not be needed. .RE -- cgit v1.2.3