#!/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 # Ensure BTS has access to public internet. /var/SysmoBTS/chk_masq for bts in "${!BTS[@]}" ; do #scp $SSH_OPTS authorized_keys root@${BTS[$bts]}:/home/root/.ssh/ echo -e "Set Date\n" ssh $SSH_OPTS root@${BTS[$bts]} "date -s '$(date)'" if [ "$?" != "0" ] ; then echo "No ssh access to BTS?" continue fi # Commands to run on all BTS: #scp $SSH_OPTS ca-fix.sh root@${BTS[$bts]}:/home/root/ #ssh $SSH_OPTS root@${BTS[$bts]} "chmod 750 /home/root/ca-fix.sh" _modelNR=$(ssh $SSH_OPTS ${BTS[$bts]} sysmobts-util model-nr) continue 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" == "1020" ] && [ "$_trxNR" == "255" ] ; then echo "Looks like a SysmoBTS" ssh $SSH_OPTS root@${BTS[$bts]} "opkg update ; opkg install osmo-bts osmo-pcu" # Nothing to do fi if [ "$_modelNR" == "65536" ] && [ "$_trxNR" == "255" ] ; then echo "Looks like a SysmoBTS 1002? (65536)" ssh $SSH_OPTS root@${BTS[$bts]} "opkg update ; opkg install osmo-bts osmo-pcu" # Nothing to do fi if [ "$_modelNR" == "2050" ] && [ "$_trxNR" == "0" ] ; then # Master Verified. echo "BTS is a 2050 Master" ssh $SSH_OPTS root@${BTS[$bts]} "opkg update" ssh $SSH_OPTS root@${BTS[$bts]} "opkg install osmo-bts osmo-pcu" #scp $SSH_OPTS pcu-ns root@${BTS[$bts]}:/bin/ #scp $SSH_OPTS tgl-s root@${BTS[$bts]}:/bin/tgl #ssh $SSH_OPTS root@${BTS[$bts]} "chmod 750 /bin/pcu-ns /bin/tgl" #gunzip -c sysmobts-mgr-arm.gz > sysmobts-mgr #ssh $SSH_OPTS root@${BTS[$bts]} "systemctl stop sysmobts-mgr" #scp $SSH_OPTS sysmobts-mgr root@${BTS[$bts]}:/usr/bin/ #ssh $SSH_OPTS root@${BTS[$bts]} "chmod 755 /usr/bin/sysmobts-mgr ; systemctl restart sysmobts-mgr" # 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" ssh $SSH_OPTS root@${BTS[$bts]} "opkg update" ssh $SSH_OPTS root@${BTS[$bts]} "opkg install osmo-bts osmo-pcu" #ssh $SSH_OPTS root@${BTS[$bts]} "/home/root/ca-fix.sh" #scp $SSH_OPTS pcu-ns root@${BTS[$bts]}:/bin/ #scp $SSH_OPTS tgl-m root@${BTS[$bts]}:/bin/tgl #ssh $SSH_OPTS root@${BTS[$bts]} "chmod 750 /bin/pcu-ns /bin/tgl" # Nothing to do. fi done #/var/SysmoBTS/opkg-1.sh if [ "$OLDPWD" != "" ]; then cd $OLDPWD fi