blob: 0e38c3a3f99bd01aac50d1376913f2948f065213 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
#!/bin/sh
# port forwarding with ssh
# installed with: update-rc.d tunnel-autossh start 18 2 3 4 5 . stop 81 0 1 6 .
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
if ! [ -x /usr/bin/autossh ]; then
echo "Where is autossh?"
exit 0
fi
case "$1" in
start)
# same as above for the collector
# here we are binding to a host with an common internal interface (127.0.0.1)
/bin/su <%= autossh_tunneluser %> -c '/usr/bin/autossh -f -N -L <%= autossh_localport %>:<%= autossh_localip %>:<%= autossh_localportservice %> <%= autossh_remotehost %> -M <%= autossh_moniport %>'
echo "adding tunnel for ldap replication"
;;
stop)
echo -n "destroying tunnel ..."
killall autossh
echo "destroyed!"
;;
*)
echo "Usage: /etc/init.d/tunnel-autossh {start|stop}"
exit 1
;;
esac
|