I am trying to make autossh set up a reverse tunnel to a server I have at home automatically with systemd. I set up a unit in /etc/systemd/system called autossh.service
It all works fine if I start the service once I am connected to the Internet. However, that is not the case on startup. It fails saying “Could not resolve hostname” since it is not connected to the Internet.
In /etc/systemd/system/autossh.service I have the line
which should in theory take care of this problem but it doesn’t. The command fails on startup (it is not online yet so it says it could not resolve the hostname) and it does not try again.
How can I solve this?