Litecel: add maint script and update perms on scripts

This commit is contained in:
Keith Whyte 2021-05-27 03:40:41 +02:00
parent e89866980b
commit a0250b4bc7
3 changed files with 89 additions and 0 deletions

View file

@ -0,0 +1,66 @@
#!/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

View file

@ -553,16 +553,36 @@ schedule { 'never':
mode => '0750'
}
file { '/var/SysmoBTS/maint.sh':
source => 'puppet:///modules/rhizo_base/var/SysmoBTS/maint.sh',
mode => '0750'
}
file { '/var/SysmoBTS/opkg.sh':
source => 'puppet:///modules/rhizo_base/var/SysmoBTS/opkg.sh',
mode => '0750'
}
file { '/var/SysmoBTS/opkg-1.sh':
source => 'puppet:///modules/rhizo_base/var/SysmoBTS/opkg-1.sh',
mode => '0750'
}
file { '/var/SysmoBTS/chk_masq':
source => 'puppet:///modules/rhizo_base/var/SysmoBTS/chk_masq',
mode => '0750'
}
file { '/var/SysmoBTS/scp-all.sh':
source => 'puppet:///modules/rhizo_base/var/SysmoBTS/scp-all.sh',
mode => '0750'
}
file { '/var/SysmoBTS/ssh-all.sh':
source => 'puppet:///modules/rhizo_base/var/SysmoBTS/ssh-all.sh',
mode => '0750'
}
file { '/root/.ssh/bts_key':
ensure => present,
mode => '0600',

View file

@ -80,6 +80,9 @@ PYTHONPATH=$PYTHONPATH:/var/rhizomatica/rccn
# It's a new day....
30 5 * * * root /home/rhizomatica/bin/check_broken.sh
# Jobs to run on the BTS
15 3 * * * root /var/SysmoBTS/maint.sh
# Check if FS or NTIB needs restart
30 2-5 * * * root /home/rhizomatica/bin/check_dirty.sh