Hot answers tagged

3

Try this: #!/bin/bash while :; do ping -c 1 8.8.8.8 >/dev/null 2>&1 if [ $? = 0 ]; then break else echo 'No internet' fi sleep 1 done mpg123 /home/user/file.mp3 It will show you 'no internet' message if there is no ping response. And if it gets the response it will execute your command and quit.


2

You can use timeout command to run your command or script in a given timeout. Something similar to this: timeout 10m command Which waits for the command to finish withing 10 minutes otherwise kills it and exits with status 124. Then you can check exit status of timeout and print the appropriate message based on it. See here for more: timeout manpage. If ...


2

There are two possible cases: you have ordered from both ISPs the fixed IPs (or ranges) and you made a special arrangement with ISP that handles your outbound traffic to allow the traffic from your site that has different source IP addresses in IP packets than this ISP provided to you. Also, most likely, this ISP would request a proof from you that these ...


1

You can ssh into the Pi with pi@hostname.local. hostname.local works in most places you would use an IP Address, although there are a few exceptions e.g. rsync. This assumes that avahi is running, which should be the case for recent installations of Raspbian


1

It could be done on a distributed system but that's not likely the case as it would make it more expensive and complicated to run. Even with a distributed system, you could never have enough servers to be perfectly aware of specific network outages. Furthermore, your total load and bandwidth would always be in function of the number of servers, which is ...


1

It's possible that your router tells the others to send directly, with an ICMP redirect packet. Since they are all on the same network, it knows this should be possible. I set up routes like yours between three Linux machines (mach1 <-> mach3 <-> mach2), and tested with a ping: mach1# ping mach2 PING mach2 (x.x.x.237) 56(84) bytes of data. From ...


1

There's nothing particularly wrong with that setup. You'll use a PPTP client to connect to the VPN provider in Sweden, first. Then route all traffic across that connection. When it's working, launch the second VPN client —I believe you said it was OpenVPN? This will be easier to keep track of if you're using different VPN protocols, but not fundamentally ...


1

It comes from your provider's internal DNS server at 192.168.74.2. That DNS server is most likely configured in /etc/resolv.conf unless you already have bind running on your machine.


1

I used dhcpdump when I was testing DHCP. It will dump both sides of the DHCP transaction. If you leave it running it will log the options passed. You may want to restart your DHCP client to see the initial negotiation. The renewal request should contain all the running configuration.


1

You could periodically ping a website and execute your command when ping returns success. Something like the following... result=1 while [ $result -ne 0 ] do ping -c 1 www.google.com result=$? sleep 5 done mpg123 /home/user/file.mp3



Only top voted, non community-wiki answers of a minimum length are eligible