Hi, I have a little script (on a Suse 10.1 server) that creates a ssh tunnel to connect a MySql slave server with it's master. The script does something like this: while true; do ssh -oBatchMode=yes -L 33306:127.0.0.1:3306 -N root@someserver >>$LOG 2>&1 sleep 30 done The loop is to re-establish the connection when the netwerk connection goes down for some reason. This works ok, but when I run this script on a remote shell the script gets killed when I close the shell. So should I make a script in /etc/init.d to make this a more permanent solution, or is there a better way? And I also have the feeling the loop isn't the best solution for the problem? ;) -- Bye, Wilfred.
On 5/17/06, Wilfred van Velzen
This works ok, but when I run this script on a remote shell the script gets killed when I close the shell. So should I make a script in /etc/init.d to make this a more permanent solution, or is there a better way? ...
Hi Wilfred, I'd suggest that you use the "screen" command to make your script run permanently even when you close the remote shell. It's installed by default in SUSE 10.1 (/usr/bin/screen). Below a good quick tutorial: http://www.linuxforums.org/applications/the_screen_program.html Cheers, -mw
On 5/17/06, Wilfred van Velzen
This works ok, but when I run this script on a remote shell the script gets killed when I close the shell. So should I make a script in /etc/init.d to make this a more permanent solution, or is there a better way?
On Wed, 2006-05-17 at 10:58 +0200, Mello wrote:
Hi Wilfred, I'd suggest that you use the "screen" command to make your script run permanently even when you close the remote shell.
Agreed. "nohup" won't work, as "ssh" requires a terminal. So "screen" is one of the few options that will work. You can setup "screen" to automagically launch commands in whatever screen you wish when started. I.e., you should write your script to launch the commands under screen. The nice, additional benefit of this approach is that you can check on the status at any time by connecting to that running screen. -- Bryan P.S. Another option would be to dedicate tty8 or something to running this script. That would work on boot. -- Bryan J. Smith Professional, technical annoyance mailto:b.j.smith@ieee.org http://thebs413.blogspot.com ----------------------------------------------------------- Americans don't get upset because citizens in some foreign nations can burn the American flag -- Americans get upset because citizens in those same nations can't burn their own
On Wednesday 17 May 2006 08:52, Wilfred van Velzen wrote:
Hi,
I have a little script (on a Suse 10.1 server) that creates a ssh tunnel to connect a MySql slave server with it's master.
The script does something like this:
while true; do ssh -oBatchMode=yes -L 33306:127.0.0.1:3306 -N root@someserver >>$LOG 2>&1 sleep 30 done
The loop is to re-establish the connection when the netwerk connection goes down for some reason.
This works ok, but when I run this script on a remote shell the script gets killed when I close the shell. So should I make a script in /etc/init.d to make this a more permanent solution, or is there a better way? And I also have the feeling the loop isn't the best solution for the problem? ;)
man nohup -- Steve Boddy
Wilfred van Velzen wrote:
This works ok, but when I run this script on a remote shell the script gets killed when I close the shell. So should I make a script in /etc/init.d to make this a more permanent solution, or is there a better way?
openvpn perhaps. Setting up a single tunnel with a static key is very, very easy. /Per Jessen, Zürich
Op woensdag 17 mei 2006 09:52, schreef Wilfred van Velzen:
I have a little script (on a Suse 10.1 server) that creates a ssh tunnel to connect a MySql slave server with it's master.
The script does something like this:
while true; do ssh -oBatchMode=yes -L 33306:127.0.0.1:3306 -N root@someserver >>$LOG 2>&1 sleep 30 done
Perhaps: ssh -f -oBatchMode=yes -L 33306:127.0.0.1:3306 -N root@someserver >>$LOG (-f added) -- Richard Bos Without a home the journey is endless
participants (6)
-
Bryan J. Smith
-
Mello
-
Per Jessen
-
Richard Bos
-
Stephen Boddy
-
Wilfred van Velzen