Broadband Related > Router Monitoring Software

Restarting DSLstats after power cut

(1/10) > >>

Westie:
A plea for help from a Linux noob  :baby:

For several months I have monitored my DSL connection using DSLstats on a Raspberyy Pi Zero W. Thanks to an excellent dsl.desktop file from roseway the program runs from boot.
I have recently started to save the data to a NAS on my LAN by modifying /etc/fstab to mount the NAS when the Pi boots, and changing the Snapshots and DataStore locations in DSLstats appropriately. Both the Pi and the NAS are allocated fixed IP addresses by the router.

So far so good...until we have a power cut!

When the power comes back on, the modem/router and Pi boot up OK, but the NAS seems to be a little slower, and is unavailable when fstab runs on the Pi. Consequently DSLstats reverts to the default locations for Snapshots and DataStore.
Ideally I want the Pi to wait, and not try to mount the NAS until it is available, or run DSLstats until the NAS is mounted.

I have searched for answers on t'internet, but cannot find anything relevant to Raspbian Stretch. (Maybe I need to refine my searching skills!) Advice varies between using a bash script...python...systemd...cron...rc.local all of which are new to me, and some of which seem to contradict!

Can anyone help, or point me in the right direction? Thanks.

Deathstar:
Do you use a start up script? If so use the sleep command.
Could be an option?

Westie:
DSLstats is invoked by a script (I think) called dslstats.desktop in /home/pi/.config/autostart.

The problem seems to be that /etc/fstab tries to mount the NAS before it is ready, because if the NAS is already running when the pi is powered on there is no problem.

Can I add a sleep command to fstab?

Weaver:
Cron? With a delta time? I am not sure how to schedule something at ‘now + n secs’, have done it on winnt with the ‘at’ command.

roseway:
dslstats.desktop isn't a script, it's a desktop shortcut, as commonly used in Linux systems to launch programs. I'm not sure if there's a way to put a delay into the program launch, but one indirect way would be:-

Write a simple script to launch DSLstats, something like this:


--- Code: ---#!/bin/sh
sleep 5
cd <path to DSLstats directory>
./dslstats

--- End code ---

Save this script as launch-dslstats in the same directory as dslstats.desktop and make it executable.

Then edit dslstats.desktop and change the Exec line to


--- Code: ---Exec=/home/pi/.config/autostart/launch-dslstats
--- End code ---

This would give a 5 second delay before starting DSLstats. Change the sleep line in the script as required for a different delay - the value is in seconds.

Navigation

[0] Message Index

[#] Next page

Go to full version