From 22b392bbc744bba81cb2fe80d40dac3f06605c90 Mon Sep 17 00:00:00 2001 From: "Wile E. Coyote" Date: Wed, 14 Jun 2017 07:37:21 +0000 Subject: [PATCH] Restart BTS nightly and nicely when thee are borken channels --- modules/rhizo_base/files/bin/check_broken.sh | 16 ++++++++++++++++ .../rhizo_base/templates/rhizomatica.cron.erb | 3 +++ 2 files changed, 19 insertions(+) create mode 100755 modules/rhizo_base/files/bin/check_broken.sh diff --git a/modules/rhizo_base/files/bin/check_broken.sh b/modules/rhizo_base/files/bin/check_broken.sh new file mode 100755 index 0000000..0262fa5 --- /dev/null +++ b/modules/rhizo_base/files/bin/check_broken.sh @@ -0,0 +1,16 @@ +#!/bin/bash +RHIZO_SCRIPT="/home/rhizomatica/bin" +. $RHIZO_SCRIPT/vars.sh +. $RHIZO_SCRIPT/rccn-functions + +NACK=`echo "show lchan" | nc -q1 localhost 4242 | grep "BROKEN UNUSABLE Error reason: NACK on activation" | wc -l` + +if [ $NACK -gt 0 ]; then + waitfor0calls + _bts=0 + for bts in $BTS1 $BTS2 $BTS3; do + echo "Dropping BTS connection $_bts due to $NACK broken (NACK) Channels" + echo -e "enable\n drop bts connection $_bts oml" | nc -q1 localhost 4242 + done + ((_bts+=2)) +fi diff --git a/modules/rhizo_base/templates/rhizomatica.cron.erb b/modules/rhizo_base/templates/rhizomatica.cron.erb index 0f7f8d8..4378f28 100644 --- a/modules/rhizo_base/templates/rhizomatica.cron.erb +++ b/modules/rhizo_base/templates/rhizomatica.cron.erb @@ -60,6 +60,9 @@ PYTHONPATH=$PYTHONPATH:/var/rhizomatica/rccn #Restart osmo-nitb every 6 hours (This wasn't working anyway. If it is needed, do something more elegant!) # 0 */6 * * * root /usr/bin/sv restart osmo-nitb 2>&1 > /dev/null +# It's a new day.... + 30 5 * * * root /home/rhizomatica/bin/check_broken.sh + # Check if FS or NTIB needs restart 30 3 * * * root /home/rhizomatica/bin/check_dirty.sh