GraseHotspot / grase-www-portal

Grase WWW Portal (Main Package)
51 stars 20 forks source link

power outage issue with solution(band aid) #167

Open bryanlorenzo79 opened 7 years ago

bryanlorenzo79 commented 7 years ago

there was already i post on google groups about this and his solution was reinstalling the server. I don't want to reinstall the server since we have a lot of power outage here. So what happen is that when there is a power outage and when the power comes back, the server doesn't work properly. The server runs and you can log in as the admin and status looks good but on the client side, the portal does not show up even after a server reboot. I did find a workaround on this problem. When the server is running, I log in as the admin and I click on the "network settings" tab. Check or uncheck the Bugos NXDOMAIN(OpenDNS) checkbox and finally save settings. After 5 mins, client should be able to login. It doesn't really matter if its checked or unchecked. I think what it does is just refresh the network settings.

We have several power outage in a month here that goes on for an hour and this method works everytime. I hope this'll help anybody out there with power outage issue and I also hope this'll get fix. I don't really want to do this everytime there is power outage. I'm using a raspberry pi so i just want to leave it running and not worry about breaking the server. Thanks!

josealgardataborges commented 7 years ago

Hi

Just a little more information.

In fact what you are doing (by means of a grase 5minute cronjob) is restart dnsmasq and chilli, by (in the background) running:

sh /usr/share/grase/scripts/update_grase_networksettings.sh

so if you have ssh access you can run it manually not having to wait for 5 minutes.

If nothing is changed Chilli/DnsMasq are not restarted, hence you need to change the "Bogus NXDOMAIN" setting, to trigger the restart, as seen in this file: https://github.com/GraseHotspot/grase-conf-dnsmasq/blob/master/update_grase_networksettings.sh

bryanlorenzo79 commented 7 years ago

Hi

Thanks for that great little info. It is certainly faster than my method. I wish there is a way to restart it automatically regardless of change in the network settings as this does not completely solve the power outage issue.

josealgardataborges commented 7 years ago

I tried several times to cut power on the hotspot, and when it reboots everything is ok, maybe its something specific about the raspberry pi and not the grase hotspot?

josealgardataborges commented 7 years ago

Anyway fiddling a little with bash (im no expert far from it actually), i came up with a script that you can run to check if the uam page is available and if not automatically restart chilli/dnsmasq, maybe you can try to make a bash file (checkuam.sh) for instance with:

   #!/bin/bash

   curl -Is $1 --connect-timeout 3 | head -1 | grep "HTTP" > /dev/null 2>&1

   if [ $? != 0 ]
   then
      service chilli restart
      service dnsmasq restart
      #
      # or you can stop them one at a time and then start them again 
      # (instead of restarting them both)
      #
      #      service chilli stop
      #      service dnsmasq stop
      #      service chilli start
      #      service dnsmasq start
      #
   fi

which you can run like this bash checkuam.sh UAM_IP, like these:

ONLINE UAM PAGE: http://prntscr.com/enfy7u (i used the right uam IP to get a sucessfull test)

OFFLINE UAM PAGE: http://prntscr.com/enfykl (i used the wrong uam IP to get a failed test, restarting chilli/dnsmasq)

And then if it solves your "problem" make it a cronjob every x minutes.

Don't forget to add the full path to the checkuam.sh file on the cronjob