On 08/01/2019 12.44, Peter Suetterlin wrote:
Carlos E. R. wrote:
Then yes, you need a daemon/cron/whatever.
If you don't find anything, you could adapt my program, but it is in Pascal: instead of calling the external program to cycle power, call network restart. The modification is almost trivial.
So ATM I'm running
#!/bin/sh ping -c 1 -w 1 -q 8.8.8.8 &> /dev/null if [ $? -ne 0 ]; then systemctl restart network fi
in cron.daily. I'll see what happens.
That may work. :-) Caveats: a single ping failure will restart the network. This may disrupt existing connections, possibly change the IP. There are other ping programs (I forget which exactly) that will try several pings - see below. If there is a local network, I would ping that first. You also need to consider what happens if cron triggers another job while this one is running if the frequency is high enough. ping variants from my notes: ping fwping (saint) ?? ping -f -l10 -s20000 router bing compute point to point throughput using two sizes of ICMP ECHO_REQUEST packets to a pair of remote hosts fping - A program to ping multiple hosts hping - Command-line oriented TCP/IP packet assembler/analyzer nping - Compare Results of Nmap Scans oping - Multiple Host Ping that supports ICMPv4 and ICMPv6 I think there are more. -- Cheers / Saludos, Carlos E. R. (from 15.0 x86_64 at Telcontar)