Reindl, thanks again for your help yesterday. I have hassled for years
with my unreliable method of setting up the SSH tunnels.
Reindl Harald:
with the small script below i see the status of all forwarding-services
including all ssh processes with their params and the last restart-time
what more does someone need to manage this out-of-the-box?
________________________________________________
cat /usr/local/bin/forwardings.sh
#!/usr/bin/bash
if [ "$1" == "" ]; then
ACTION="status"
else
ACTION="$1"
fi
/usr/bin/systemctl $ACTION forward-host1.service
forward-host2.service...................
I fiddled with this, trying to strip down the information to what is
absolutely necessary, but then I realized that all I ever want to know
is whether the port is open.
I propose a different approach, one which directly checks to see whether
the tunneled port is actually being listened to. This is my script:
----------------------------------------------
#!/usr/bin/bash
echo -n "Squid >>> " && lsof -i -n -P |grep "3128 (LISTEN)"
echo -n "Cups >>> " && lsof -i -n -P |grep "631 (LISTEN)"
echo -n "Mysql >>> " && lsof -i -n -P |grep "22306 (LISTEN)"
echo -n "Myth43 >>> " && lsof -i -n -P |grep "6543 (LISTEN)"
echo -n "Myth44 >>> " && lsof -i -n -P |grep "6544 (LISTEN)"
echo -n "Sane >>> " && lsof -i -n -P |grep "6566 (LISTEN)"
echo -n "Tor9151 >>> " && lsof -i -n -P |grep "9151 (LISTEN)"
echo -n "Tor9152 >>> " && lsof -i -n -P |grep "9152 (LISTEN)"
echo -n "Tor9153 >>> " && lsof -i -n -P |grep "9153 (LISTEN)"
echo -n "Tor9154 >>> " && lsof -i -n -P |grep "9154 (LISTEN)"
echo -n "Tor9155 >>> " && lsof -i -n -P |grep "9155 (LISTEN)"
echo -n "Tor9156 >>> " && lsof -i -n -P |grep "9156 (LISTEN)"
echo -n "Tor9157 >>> " && lsof -i -n -P |grep "9157 (LISTEN)"
echo -n "Tor9158 >>> " && lsof -i -n -P |grep "9158 (LISTEN)"
echo -n "Tor9159 >>> " && lsof -i -n -P |grep "9159 (LISTEN)"
echo -n "Tor9160 >>> " && lsof -i -n -P |grep "9160 (LISTEN)"
echo -n "Tor9161 >>> " && lsof -i -n -P |grep "9161 (LISTEN)"
echo -n "Tor9162 >>> " && lsof -i -n -P |grep "9162 (LISTEN)"
echo -n "Tor9163 >>> " && lsof -i -n -P |grep "9163 (LISTEN)"
echo -n "Tor9164 >>> " && lsof -i -n -P |grep "9164 (LISTEN)"
echo -n "Tor9165 >>> " && lsof -i -n -P |grep "9165 (LISTEN)"
echo
----------------------------------------------
Only problem is, if a port is not listening it glitches the display
since I use -n.
_______________________________________________
systemd-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/systemd-devel