Check for idle connections and reconnect when failed. For use with "systemd" "units". A timer unit checks every 5 minutes whether there is a connection via a specific port (ESTABLISHED). If the connection is missing, a system service is started to re-establish the connection.
-
Mail agent (fetchmail, getmail) loses connection to the IMAP IDLE account, e.g. because of a forced disconnection by the DSL provider.
-
IMAP IDLE connection to a server is not stable and breaks off, e.g. due to a network change WiFi> Mobile data> WiFi (sailfish OS).
- Copy
connection-check.shto the location of your choice. - Open the file
connection-check.shChange PORT with the number of the port you want to check. Change line 14 and add the command or systemd service you want to restart and save it. - Copy
connection-check.timerto/etc/systemd/system/ - Copy
connection-check.serviceto/etc/systemd/system/ - Open
connection-check.service. Change the path in service file to whereconnection-check.shis and save it. - Restart the systemd daemon with:
systemctl daemon-reload
- Start the timer:
systemctl start connection-check.timer
- To start the timer at boot do:
systemctl enable connection-check.timer