[arm-allstar] Announce when Internet is lost
Dave Petrie
wa2kjc at gmail.com
Mon Nov 13 22:11:22 EST 2023
ok i changed the internet.sh and chmod +x and i got the online announcement
every minute
so i unplugged the ethernet to the raspberry and got nothing and waited for
three minutes
then plugged ethernet back in and got three plays of online announcement
and am still
getting it every minute, i like to tinker but don't want to keep you up all
night
maybe a different way to look at it if i can get the offline to work and
the online is
working right now every minute
maybe command the ct= in rpt to change depending on what state
so that the only way i will know there is internet or no internet is to hear
the courtesy tone change depending on the state but only if i key up the
repeater
On Mon, Nov 13, 2023 at 9:33 PM Danny K5CG <k5cg at hamoperator.org> wrote:
> Dave,
>
> This script will run as root from crontab so you don't really need the
> sudo at the front.
>
> And use -rx for playback, as well you probably want localplay instead of
> playback for the local repeater only.
>
> You could touch/remove a file in /tmp to track current status. Like this.
>
> wget -q --spider http://google.com
>
> # if the test fails and the tmp file does not exist
> if [ $? -gt 0 ] -a [ ! -f /tmp/internetdown ] ; then
> # play the message
> /usr/bin/asterisk *-rx* "rpt *localplay* 40039 /etc/asterisk/local/
> *offline*"
> # create the flag
> touch /tmp/internetdown
> else
> # internet is back online
> /usr/bin/asterisk *-rx* "rpt *localplay* 40039 /etc/asterisk/local/
> *online*"
> # remove the flag
> rm -f /tmp/internetdown
> fi
>
> Something like that.
>
> Let me know...
>
>
> 73
> Danny, K5CG
> HH 550-000-0609
> SKCC 14257
>
> ------------------------------
> *From: *"Dave Petrie" <wa2kjc at gmail.com>
> *To: *"ARM Allstar" <arm-allstar at hamvoip.org>
> *Cc: *"Danny Siminiuk" <k5cg at hamoperator.org>
> *Sent: *Monday, November 13, 2023 8:14:45 PM
> *Subject: *Re: [arm-allstar] Announce when Internet is lost
>
> got it, now to stop playing every minute the network is down or maybe
> just change the announcement to a simple tone, beep, burp
> but i don't want it to keyup every minute, getting there
>
>
> wget -q --spider http://google.com
>
> if [ $? -gt 0 ]; then
>
> sudo /usr/bin/asterisk -vvvr -x "rpt playback 40039
> /etc/asterisk/local/offline"
>
> On Mon, Nov 13, 2023 at 8:34 PM Dave Petrie <wa2kjc at gmail.com> wrote:
>
>> ok i am working on it, almost there, it's not announcing yet when i
>> unplug the internet to the raspberry with the repeater up and running
>> here is what i have done, tell me what you think and what do i change to
>> announce it is back when i can ping google,
>> do i change the -gt 0 to a -gt 1 in another line
>>
>>
>>
>> i named your script internet.sh and put it in /etc/asterisk/local
>> and chmod +x internet.sh
>>
>> #!/usr/bin/bash
>>
>> wget -q --spider http://google.com
>>
>> if [ $? -gt 0 ]; then
>>
>> echo sudo /usr/bin/asterisk -vvvr -x "rpt playback 40039
>> /etc/asterisk/local/offline"
>>
>> fi
>>
>> then in crontab -e
>>
>> it plays from the command line just not automatically from disconnecting
>> the internet and waiting 3 or 4 minutes
>>
>>
>>
>> */1 * * * * /etc/asterisk/local/internet.sh
>>
>> On Mon, Nov 13, 2023 at 7:28 PM Danny K5CG via ARM-allstar <
>> arm-allstar at hamvoip.org> wrote:
>>
>>> Dave,
>>>
>>> There's probably so many ways to do that they can't be listed, but
>>> here's one that should work for you.
>>>
>>> Create a new script and give it execute permission.
>>>
>>>
>>> #!/usr/bin/bash
>>>
>>> wget -q --spider http://google.com
>>>
>>> if [ $? -gt 0 ]; then
>>> echo "Offline"
>>> fi
>>>
>>>
>>> Replace the echo line with whatever asterisk command you want that will
>>> play a local file.
>>>
>>> Add the script to your crontab to run every minute.
>>>
>>> One idea of many.
>>>
>>> 73
>>> Danny, K5CG
>>> HH 550-000-0609
>>> SKCC 14257
>>>
>>> ----- Original Message -----
>>> From: "ARM Allstar" <arm-allstar at hamvoip.org>
>>> To: "ARM Allstar" <arm-allstar at hamvoip.org>
>>> Cc: "Dave Petrie" <wa2kjc at gmail.com>
>>> Sent: Monday, November 13, 2023 7:22:57 AM
>>> Subject: [arm-allstar] Announce when Internet is lost
>>>
>>> Is there anyway to run a script that would ping let's say 8.8.8.8 and
>>> announce
>>> over the local repeater the hamvoip raspberry is controlling, that the
>>> internet has been lost, disconnected.
>>> I am helping a Ham friend that is a History teacher at a school and is
>>> setting up, with the support and enthusiasm from school staff and
>>> principal, a uhf repeater with a internet hotspot that recently stopped
>>> working, i know there are lots of reason for the disconnect, we just want
>>> to know when it happens.
>>> Thanks
>>> Dave
>>> _______________________________________________
>>>
>>> ARM-allstar mailing list
>>> ARM-allstar at hamvoip.org
>>> http://lists.hamvoip.org/cgi-bin/mailman/listinfo/arm-allstar
>>>
>>> Visit the BBB and RPi2/3/4 web page - http://hamvoip.org
>>> _______________________________________________
>>>
>>> ARM-allstar mailing list
>>> ARM-allstar at hamvoip.org
>>> http://lists.hamvoip.org/cgi-bin/mailman/listinfo/arm-allstar
>>>
>>> Visit the BBB and RPi2/3/4 web page - http://hamvoip.org
>>>
>>
>
More information about the ARM-allstar
mailing list