Date: Thu, 01 Feb 2007 10:46:15 +0100 From: Frank Staals <frankstaals@gmx.net> To: questions@FreeBSD.org Subject: Automatically detach screen after given amount of time ? / Authpf in background ? Message-ID: <45C1B6E7.1090102@gmx.net>
next in thread | raw e-mail | index | archive | help
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 <username> you are authenticated from <ip>' 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 <command>' 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?45C1B6E7.1090102>