Am 05.07.2013 21:20, schrieb cac...@quantum-sci.com: > Reindl Harald: >> "oneshot" is plain wrong if you have a long living prcoess >> below a working unit to have a remote-server's ssh on localhost:10024 >> "RestartSec=60" because so it survives reboots of the forwarded machine with >> auto reconnect >> >> [Unit] >> Description=SSH-Forwarding >> After=network.service openvpn.service >> >> [Service] >> Type=simple >> ExecStart=/usr/bin/ssh -i /home/gateway/.ssh/id_rsa gateway@target-host -N >> -C -L127.0.0.1:10024:127.0.0.1:22 >> Restart=always >> RestartSec=60 >> TimeoutSec=30 >> >> [Install] >> WantedBy=multi-user.target > > Thank you. But this is good for only one port, and I have over 20.
i have 6 > This is the reason I used oneshot, as you can have multiple ExecStarts. Of > course it doesn't work. i know, been there, done that > But does this mean I have to have over 20 .services for my reverse tunnels? > They could all start in parallel, but is there no better way? this is a *perfect* way and the only one "Restart=always" can work relieable no matter how many of them, build one, test it carefully and copy it as often as need with the minimal change of port/host, that's hardly more work than a unrelieable wrapper script 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................... ________________________________________________ > Would they wake from sleep? Would they auto-restart if a broken pipe? anything which let die the "ssh" process results in restart
signature.asc
Description: OpenPGP digital signature
_______________________________________________ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel