View previous topic :: View next topic |
Author |
Message |
pmatos Veteran
![Veteran Veteran](/images/ranks/rank_rect_5_vet.gif)
Joined: 06 Jun 2003 Posts: 1246 Location: Eckental, Germany
|
Posted: Thu Jun 21, 2007 8:11 am Post subject: Setting up tunnels |
|
|
Hi all,
I'd like to have a couple of ssh tunnels set up in my PC all the time. Is there any app to manage tunnels, start them when computer boots and keep them up (in case they go down for some reason)?
Cheers,
Paulo Matos |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
di1bert l33t
![l33t l33t](/images/ranks/rank_rect_4.gif)
![](images/avatars/1322078658465db3da4a87f.gif)
Joined: 16 May 2002 Posts: 963 Location: Oslo, Norway
|
Posted: Thu Jun 21, 2007 8:28 am Post subject: |
|
|
I've not come across anything like this, not for OpenSSH tunnels anyway. You could get clever and
write a little bash script to take care of starting the tunnels and just put it in /etc/conf.d/local.start
Here's a "template" file I use for my bash scripts....
Code: |
#!/bin/bash
PIDFILE="/var/run/fork.pid"
function main {
# print the pid of the forked daemon
echo "forking to background ($[ $$ +1 ])"
touch $PIDFILE
echo $[ $$ +1 ] > $PIDFILE
running="yes"
while [ $running == "yes" ]; do
echo Sample Code Here
done
}
ARGV="$1"
# print program usage if no command line arguements are supplied
function usage {
echo "Please run with "-d" to start the service in daemon mode"
exit 0
}
# Check what was passed as an arguement and act accordingly
if [ "$ARGV" == "" ]; then
usage
fi
if [ "$ARGV" == "-d" ]; then
main &
fi
|
Hope this helps...
-m |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
pmatos Veteran
![Veteran Veteran](/images/ranks/rank_rect_5_vet.gif)
Joined: 06 Jun 2003 Posts: 1246 Location: Eckental, Germany
|
Posted: Thu Jun 21, 2007 8:32 am Post subject: |
|
|
di1bert wrote: | I've not come across anything like this, not for OpenSSH tunnels anyway. You could get clever and
write a little bash script to take care of starting the tunnels and just put it in /etc/conf.d/local.start
Here's a "template" file I use for my bash scripts....
Code: |
#!/bin/bash
PIDFILE="/var/run/fork.pid"
function main {
# print the pid of the forked daemon
echo "forking to background ($[ $$ +1 ])"
touch $PIDFILE
echo $[ $$ +1 ] > $PIDFILE
running="yes"
while [ $running == "yes" ]; do
echo Sample Code Here
done
}
ARGV="$1"
# print program usage if no command line arguements are supplied
function usage {
echo "Please run with "-d" to start the service in daemon mode"
exit 0
}
# Check what was passed as an arguement and act accordingly
if [ "$ARGV" == "" ]; then
usage
fi
if [ "$ARGV" == "-d" ]; then
main &
fi
|
Hope this helps...
-m |
Thank you very much. In the meantime I also found autossh so joining your solution with autossh might be great! ![Very Happy :D](images/smiles/icon_biggrin.gif) |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
di1bert l33t
![l33t l33t](/images/ranks/rank_rect_4.gif)
![](images/avatars/1322078658465db3da4a87f.gif)
Joined: 16 May 2002 Posts: 963 Location: Oslo, Norway
|
Posted: Thu Jun 21, 2007 8:35 am Post subject: |
|
|
Glad to help..I'd be interested to see the end result.
I think I tried autossh before and I'm not sure how well it worked....
Anyhoo...good luck
-m |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
|