vincenthsu / systemd-ngrok

Automatically start ngrok by systemd
The Unlicense
475 stars 170 forks source link

Service gone after network error #5

Open magnuswikhog opened 4 years ago

magnuswikhog commented 4 years ago

I installed ngrok and got it working on a Raspberry Pi using this library, but unfortunately it seems that if the network connection goes down for a few hours and then comes back, ngrok will not reconnect. If I run service --status-all I don't see the ngrok service.

peter279k commented 4 years ago

I think this issue is about ngrok.service file setting.

After looking at the After=network.target setting on [Unit] block, it has been consider using the network-online.target instead.

These are different and some descriptions are as follows:

On current systems, ordering after network.target just guarantees that the network service has been started, not that there's some actual configuration. You need to order after network-online.target and pull it in to achieve that.

Some useful references are as follows:

suan commented 3 years ago

@magnuswikhog @peter279k Curious, is this still an issue, and has it been verified that using network-online.target instead of network.target fixes it?

peter279k commented 3 years ago

Yes. You can refer my posts I provide :).

I use the network-online for my Ngrok with systemd and it's worked when having the network error.