From owner-freebsd-questions@FreeBSD.ORG Thu Feb 1 09:46:21 2007 Return-Path: X-Original-To: questions@FreeBSD.org Delivered-To: freebsd-questions@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 0378816A579 for ; Thu, 1 Feb 2007 09:46:20 +0000 (UTC) (envelope-from frankstaals@gmx.net) Received: from mail.gmx.net (mail.gmx.net [213.165.64.20]) by mx1.freebsd.org (Postfix) with SMTP id E7AE713C4A6 for ; Thu, 1 Feb 2007 09:46:17 +0000 (UTC) (envelope-from frankstaals@gmx.net) Received: (qmail invoked by alias); 01 Feb 2007 09:46:16 -0000 Received: from ip176-173-59-62.adsl.versatel.nl (EHLO [192.168.5.5]) [62.59.173.176] by mail.gmx.net (mp039) with SMTP; 01 Feb 2007 10:46:16 +0100 X-Authenticated: #25365336 Message-ID: <45C1B6E7.1090102@gmx.net> Date: Thu, 01 Feb 2007 10:46:15 +0100 From: Frank Staals User-Agent: Thunderbird 1.5.0.9 (X11/20070125) MIME-Version: 1.0 To: questions@FreeBSD.org Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Y-GMX-Trusted: 0 Cc: Subject: Automatically detach screen after given amount of time ? / Authpf in background ? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2007 09:46:21 -0000 A couple days ago I set up authpf on my FreeBSD gateway for authentication of my wifi network. Everything works great, the only thing that is/was bothering me was that I had to keep open a terminal on my laptop for the ssh session. I quickly thought of using screen to fix that problem. The thing is I want to see the confirmation authpf gives when starting the ssh transfer ( The 'welcome you are authenticated from ' message ). After that it should just send the ssh session to the background. So I came up with this script : frank@Riza$ cat /home/scripts/root/seescreen #!/bin/sh #### script to log in to connect to screen for only a set amount of time ## Settings to use: rtime="3" ## time to wait before calling screen's reatach dtime="4" ## time to wait before calling screen's detach # if called with '-reatach' if [ "$1" = "-reatach" ] ; then sleep $rtime seescreen -detach & screen -r fi # if called with '-detach' if [ "$1" = "-detach" ] ; then sleep $dtime screen -d fi now I could start my authentication session with 'screen -wipe; sudo wlan ; seescreen -reatach ; screen -d -m ssh -l wifi wlanserver'. ( where wlan is an other script to set up my wlan connection '. I made an alias in my bashrc file to prevent typing all this. The weird thing is that the first times I ran my script during testruns I could set the rtime to 1 but then it seemed that wasn't enouth time so I had to make 2 of it and everything worked again. But then it didn't work with 2 either and I had to set it to 3 and now even 3 doesn't seem enough to reconnect to my screen session. It shouldn't take that long to start the 'screen -d -m ' does it ? So my question was: Am I missing something resulting in the need of a longer rtime ? If there is nothing wrong with it what would be a good value ? Or is there some other way I could run my ssh session in the background ? Regards, -- -Frank Staals