[arm-allstar] A way to automate when another node connects

Doug Crompton wa3dsp at gmail.com
Fri Feb 23 12:05:01 EST 2018


Jim,

 I quickly threw together this script. It will get you started. It may not
be exactly what you want. It disconnects one specific node based on another
specific node connecting. It could be modified to do many things. Note the
actual Asterisk commands are commented out for test. You must have smlogger
running as noted in the script.
If you don't understand scripting and you need me to further explain or
change let me know. I would need to specifically know what you want to do.
Possibly disconnect all connected nodes when another connect was made?


*73 Doug*

*WA3DSP*

*http://www.crompton.com/hamradio <http://www.crompton.com/hamradio>*


cat node-check.sh


#!/bin/bash

#  Connect/Disconnect second node
#  based on first node connected
#  Uses smlogger. If not using
#  supermon add to rpt.conf in the
#  node stanza you are checking -
#
#  connpgm=/usr/local/sbin/supermon/smlogger 1
#  discpgm=/usr/local/sbin/supermon/smlogger 0
#
#  WA3DSP, 2/2018

if [ -z $1 ] || [ -z $2 ] || [ -z $3 ]
  then
   echo -e "\nnode-check.sh <mynode> <node1> <node2>"
   echo -e "\n  Check if node1 connects and disconnect node2"
   echo -e "  If node 1 disconnects reconnect node1\n"
   exit
fi

mynode=$1
logfile="/var/log/asterisk/connectlog"
prefix="Connected Allstar"

while true
do
 tail -fqn0 $logfile | \
 while read line ; do
        result=`echo "$line" | grep "$prefix $2"`
        if [ $? = 0 ]
        then
         # echo "$result"
         if [[ $result == *"Connect"* ]]
           then
            # do connect things
            echo "Connect $2 to $mynode - Disconnect $3 from $mynode"
            prefix="Disconnected Allstar"
        # asterisk -rx "rpt fun $mynode *1$3"
         fi
         if [[ $result == *"Disconnect"* ]]
           then
            # do disconnect things
            echo "Disconnect $2 from $mynode - Connect $3 to $mynode"
            prefix="Connected Allstar"
        # asterisk -rx "rpt fun $mynode *3$3"
         fi
        fi
 done
done




On Fri, Feb 23, 2018 at 9:03 AM, "John Griffith via arm-allstar" <
arm-allstar at hamvoip.org> wrote:

> Good Morning.
>
> I keep my repeater on a particular repeater system 24/7.  It's best
> practice
> on this network to disconnect from the network if you are going to have
> anyone
> connect to your node from anywhere else.
>
> Is there a way or can someone write a script to automatically disconnect
> from your default network when receiving a connection from another node,
> and
> re-connect
> once the other station disconnects? Just talking to people about this, it's
> a very wanted script.
>
> John Griffith N7OKN
>
> _______________________________________________
>
> 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 web page - http://hamvoip.org
>


More information about the arm-allstar mailing list