New on LowEndTalk? Please Register and read our Community Rules.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
Systemd Scripts Not working at boot time
Hello
I have two scripts that I want to run on my orangepi
SSH Tunnel
OPENVPN
I want to start these at the boot time...
Now after reboot to test
systemctl status sshtunnel.service
gives me failure
and
netstat -tulnp | grep ssh
shows the tunnel is not up
Now without changing anything
systemctl start sshtunnel.service
netstat -tulnp | grep ssh
shows the tunnel is up
which is weird IMO
The problem is same with the openvpn
It simply doesnt work at boot time
systemctl status openvpn-germany.service DEAD
systemctl start openvpn-germany.service
systemctl status openvpn-germany.service ACTIVE
Thanx in advance
Comments
Under [Unit], instead of "network.target" try "network-online.target"
Isn't not-working and generally creating a clusterfuck the very raison d'etre and normal state of systemd infected systems?
Worked like a charm
Still There is one issue left
if modem and orangepi are rebooted
The orangepi tries to setup an ssh tunnel even if the ISP modem is not up....
no internet so it fails...
Cool beans
In that case I'd probably suggest to move your ssh tunnel setup to a script and at the beginning of the script write a loop that pings your modem IP and only run the tunnel setup command after a successful reply. Or similarly grep the output of ifconfig for an IP in a loop, sleeping every x seconds, until the IP is given. Then just call this script in your ExecStart in your service config instead of running the ssh tunnel command directly.
not answering your question directly, if you had openvpn why you need to setup SSH tunnel? Why don't connect to your openvpn server and connect to your orange pi from there?
I use same setup with you, but without ssh tunnel.
BOTH were not working at startup .....:-)
Now the ssh tunnel systemd is up and running ....
well i could directly do curl google.com or host google.com a much better way to determine internet connectivity
and make that systemd script and add in each Requires/Wants section of the systemd scripts
They wont fire until the internet is up :-)