0

Here is the project brief: I'm setting 3 TVs to the wall of my bakery store to show the menu. I have mini pc with Ubuntu at the back of my each TVs to send contents. The way that my mini PCs delivering contents is when the power is on it is going to auto start a browser and visit URl that has my menus.

Here is the problem that I have: It is perfect when the internet connection and the server that hosing my website is stable, but both of those two things is not stable at all in realty. My mini pc lose internet connection once in while, and sometimes my website is offline for some reason.

Is there any way to make a alternative to visit latest cached or saved version of URL when the browser trying to visit the URL and there is no internet connection or the website is down.

Thank you so much.

1 Answer 1

1

There are many ways how this can be achieved. I would say that the simplest could be something like this :

Instead of starting browser, start the bash script that would use wget to fetch your webpage localy to the home directory of the user that runs the browser. After that, start the actual browser pointing it to the local copy of the webpage. If wget fails, just simply continue a start the browser and it would start with the previous version. If you have the server under your control, than you might also share directory with the menu through NFS and the client machines would just test whether the NFS drive is mounted and if yes, then it would copy from NFS to the local directory instead of using wget.

The actual implementation might depend on how the webpage is complicated, what firewalls you have, etc. If you use bash scripts, instead of just running browser, you might build in some additional logic that warns that the menu might be old or something like this.

3
  • If using wget, using the --mirror flag may be helpful, as it downloads all the links present in that page as well. Jun 17, 2015 at 15:52
  • @saiarcot895 : very good Idea, I was also thinking about --timeout=.. to specify timeout. In fact the best would be to go through all the options of wget and consider which of them are best for given situation. To test return value wget, it may be used as parameter to if, or the return value may simply be ignored and browser started immediatelly after that.
    – ludvik02
    Jun 17, 2015 at 16:30
  • Wow thank you guys with so many helpful ideas! I will test it today~~
    – Renjie
    Jun 18, 2015 at 11:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .