Difference between revisions of "Network/SSH"
Jump to navigation
Jump to search
(Created page with "== Tunneling == === Script de création/suppression auto de tunnels === Ce script est a l'origine destiné a Bacula. Pour rajouter un host, il suffit de modifier la ligne "...") |
(No difference)
|
Revision as of 15:28, 20 December 2011
Tunneling
Script de création/suppression auto de tunnels
Ce script est a l'origine destiné a Bacula.
Pour rajouter un host, il suffit de modifier la ligne "HOSTS=...". Le port a utiliser s'incremente tout seul, en partant de 9110.
#!/bin/bash HOSTS=host1 host2 # Stop all tunnels TUNNEL_COUNT=$(ps ax|grep ssh|grep bacula-tun|awk '{print $1}'|wc -l) if [ ! $TUNNEL_COUNT == "0" ]; then kill $(ps ax|grep ssh|grep bacula-tun|awk '{print $1}') fi PORT=1000 for H in $HOSTS; do echo $H:$PORT autossh -M0 -f -N -o "ServerAliveInterval 60" -o "ServerAliveCountMax 3" -L $PORT:localhost:9102 -R 9103:si0-2.gre.winsoft.fr:9103 bacula-tun@$H & let PORT=$PORT+1 done