#!/bin/bash # This script should be updated from time to time # with nightly tasks for the BTS # Consider when making modifications that # running the script more than once is expected to be safe. if [ "$PWD" != "/var/SysmoBTS" ]; then OLDPWD=$PWD cd /var/SysmoBTS fi SSH_OPTS="-o StrictHostKeyChecking=no -o UserKnownHostsFile=/tmp/known-$RANDOM" . /home/rhizomatica/bin/vars.sh for bts in "${!BTS[@]}" ; do scp $SSH_OPTS authorized_keys root@${BTS[$bts]}:/home/root/.ssh/ if [ "$?" != "0" ] ; then echo "No ssh access to BTS?" continue fi # Commands to run on all BTS: # Nothing to do. _modelNR=$(ssh $SSH_OPTS ${BTS[$bts]} sysmobts-util model-nr) if [ "$?" == "127" ]; then echo "No sysmobts-util?" continue fi _trxNR=$(ssh $SSH_OPTS ${BTS[$bts]} sysmobts-util trx-nr) if [ "$?" != "0" ] ; then echo "TRX Number?" continue fi if [ "$_modelNR" == "65535" ] && [ "$_trxNR" == "255" ] ; then echo "Looks like a SysmoBTS" # Nothing to do fi if [ "$_trxNR" == "0" ] ; then # Master Verified. echo "BTS is a 2050 Master" # things to do scp $SSH_OPTS rc.local root@${BTS[$bts]}:/etc/rc.local ssh $SSH_OPTS root@${BTS[$bts]} "chmod 750 /etc/rc.local" fi if [ "$_trxNR" == "1" ] ; then # Slave Verified. echo "BTS is a 2050 Slave" # Nothing to do. fi done if [ "$OLDPWD" != "" ]; then cd $OLDPWD fi