Add shell util functions

This commit is contained in:
Keith Whyte 2021-05-23 05:22:02 +02:00
parent f3f4890704
commit aa35d682e8

View file

@ -107,6 +107,10 @@ pdpc () {
expect -c 'spawn -noecho telnet 0 4245; expect >; send enable\r; expect #; send "show pdp-context all\r"; expect #' | grep "PDP Address" | grep -v invalid | wc -l
}
mmc () {
expect -c 'spawn -noecho telnet 0 4245; expect >; send enable\r; expect #; send "show mm-context all\r"; expect #' | grep IMEI | wc -l
}
ns () {
expect -c 'spawn -noecho telnet 0 4245; expect >; send enable\r; expect #; send "show ns\r"; expect #' | grep ALIVE;
}
@ -118,3 +122,23 @@ pp () {
op () {
ps awxf | grep [o]smo\-
}
lock () {
if [ "$1" == "" ] ; then
echo "BTS #?"
return
fi
expect -c 'set bts '$1'; spawn telnet localhost 4242; expect ">"; send "enable\r"; expect "#"; send "configure terminal\r"; expect "#";
send "network\r"; expect "#"; send "bts $bts\r"; expect "#"; send "trx 0\r"; expect "#"; send "rf_locked 1\r";
expect "#"; send "exit\r"; expect "#"; send "exit\r"; expect "#"; send "exit\r"; expect "#"; send "exit\r"; expect "#"';
}
unlock () {
if [ "$1" == "" ] ; then
echo "BTS #?"
return
fi
expect -c 'set bts '$1'; spawn telnet localhost 4242; expect ">"; send "enable\r"; expect "#"; send "configure terminal\r"; expect "#";
send "network\r"; expect "#"; send "bts $bts\r"; expect "#"; send "trx 0\r"; expect "#"; send "rf_locked 0\r";
expect "#"; send "exit\r"; expect "#"; send "exit\r"; expect "#"; send "exit\r"; expect "#"; send "exit\r"; expect "#"';
}