Ports close randomly

Hello everyone,

I hope someone can help me.

I realized that my box randomly (every 5-7 days) closes the ports of my nextcloud (80, 443). And I find myself disconnected from my cloud.

Solution found:
Go to my nextcloud locally: https://IP:4443, on the port tab. Without changing anything just press apply. The ports are open again, and I can access my cloud.

What script is launched when I press this button ? and where to find it ? I want to create a routine that will run this script every X time or at each disconnection.

Thanks :slight_smile:

You can find discriptions of NCP tools here.
The scripts are available from Github

What button? A screenshot could help!


This one.

Great, thank you. Last question, is there a way to launch a scirpt at each time port closed? Instead of setting a timeout.

Sure you can! As per Stackoverflow

# Success
curl -sL -w "%{http_code}\n" https://google.com:443 -o /dev/null
# Non existing page
curl -sL -w "%{http_code}\n" https://google.com/zombi -o /dev/null
# Error - e.g. port closed
curl -sL -w "%{http_code}\n" localhost:9090 -o /dev/null

You can add it to cron (periodical check) and enhance with command that will reopen your port if closed (e.g. code 000 or simply not 200).

Perfect! That’s exactly what I’m looking for. @gas85 thanks

1 Like