From 26697a4656053e8d4d5873b9d53d8d2032ea09e6 Mon Sep 17 00:00:00 2001 From: s-s-s Date: Thu, 23 Feb 2017 19:31:34 +0300 Subject: [PATCH 1/5] Create DMRIDUpdateBMRU.sh Get latest IDs from the BrandMeister network database. Modified for users from Russia --- DMRIDUpdateBMRU.sh | 97 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 DMRIDUpdateBMRU.sh diff --git a/DMRIDUpdateBMRU.sh b/DMRIDUpdateBMRU.sh new file mode 100644 index 0000000..404ef59 --- /dev/null +++ b/DMRIDUpdateBMRU.sh @@ -0,0 +1,97 @@ +#! /bin/bash + +############################################################################### +# +# DMRIDUpdate.sh +# +# Copyright (C) 2016 by Tony Corbett G0WFV +# edit by R2AJV +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +############################################################################### +# +# On a Linux based system, such as a Raspberry Pi, this script will perform all +# the steps required to maintain the DMRIds.dat (or similar) file for you. +# +# It is designed to run from crontab and will download the latest IDs from the +# BM network database and optionally keep a backup of previously +# created files for you. +# +# It will also prune the number of backup files according to a value specified +# by you in the configuration below. +# +# When done, it will restart MMDVMHost to make the ID changes take effect. +# +# To install in root's crontab use the command ... +# +# sudo crontab -e +# +# ... and add the following line to the bottom of the file ... +# +# 0 0 * * * /path/to/script/DMRIDUpdate.sh 1>/dev/null 2>&1 +# +# ... where /path/to/script/ should be replaced by the path to this script. +# +############################################################################### +# +# CONFIGURATION +# +# Full path to DMR ID file +DMRIDFILE=/path/to/DMR/ID/file/DMRIds.dat +# +# How many DMR ID files do you want backed up (0 = do not keep backups) +DMRFILEBACKUP=1 +# +# Command line to restart MMDVMHost +RESTARTCOMMAND="systemctl restart mmdvmhost.service" +# RESTARTCOMMAND="killall MMDVMHost ; /path/to/MMDVMHost/executable/MMDVMHost /path/to/MMDVM/ini/file/MMDVM.ini" + +############################################################################### +# +# Do not edit below here +# +############################################################################### + +# Check we are root +if [ "$(id -u)" != "0" ] +then + echo "This script must be run as root" 1>&2 + exit 1 +fi + +# Create backup of old file +if [ ${DMRFILEBACKUP} -ne 0 ] +then + cp ${DMRIDFILE} ${DMRIDFILE}.$(date +%d%m%y) +fi + +# Prune backups +BACKUPCOUNT=$(ls ${DMRIDFILE}.* | wc -l) +BACKUPSTODELETE=$(expr ${BACKUPCOUNT} - ${DMRFILEBACKUP}) + +if [ ${BACKUPCOUNT} -gt ${DMRFILEBACKUP} ] +then + for f in $(ls -tr ${DMRIDFILE}.* | head -${BACKUPSTODELETE}) + do + rm $f + done +fi + +# Generate new file +curl 'http://registry.dstar.su/dmr/DMRIds.php' 2>/dev/null > ${DMRIDFILE} + +# Restart MMDVMHost +eval ${RESTARTCOMMAND} From fd5e0646276c72c38d5000c80e26a508f02ef9a4 Mon Sep 17 00:00:00 2001 From: Sergei Date: Fri, 10 Mar 2017 13:43:35 +0300 Subject: [PATCH 2/5] Rename DMRIDUpdateBMRU.sh to DMRIDUpdateBM.sh --- DMRIDUpdateBMRU.sh => DMRIDUpdateBM.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename DMRIDUpdateBMRU.sh => DMRIDUpdateBM.sh (100%) diff --git a/DMRIDUpdateBMRU.sh b/DMRIDUpdateBM.sh similarity index 100% rename from DMRIDUpdateBMRU.sh rename to DMRIDUpdateBM.sh From aa35de7f608633602e0e9398b09be53a3c3ffc6a Mon Sep 17 00:00:00 2001 From: Sergei Date: Fri, 10 Mar 2017 13:44:11 +0300 Subject: [PATCH 3/5] Update DMRIDUpdateBM.sh --- DMRIDUpdateBM.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DMRIDUpdateBM.sh b/DMRIDUpdateBM.sh index 404ef59..bc40817 100644 --- a/DMRIDUpdateBM.sh +++ b/DMRIDUpdateBM.sh @@ -41,7 +41,7 @@ # # ... and add the following line to the bottom of the file ... # -# 0 0 * * * /path/to/script/DMRIDUpdate.sh 1>/dev/null 2>&1 +# 0 0 * * * /path/to/script/DMRIDUpdateBM.sh 1>/dev/null 2>&1 # # ... where /path/to/script/ should be replaced by the path to this script. # From 3f094a7e77896df063b2bafcbd06a0dab4ff48de Mon Sep 17 00:00:00 2001 From: Sergei Date: Mon, 13 Mar 2017 08:46:02 +0300 Subject: [PATCH 4/5] Update RSSI_gm340uhf_RA4NHY.dat --- RSSI/RSSI_gm340uhf_RA4NHY.dat | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/RSSI/RSSI_gm340uhf_RA4NHY.dat b/RSSI/RSSI_gm340uhf_RA4NHY.dat index 1a84ffa..9d55e18 100644 --- a/RSSI/RSSI_gm340uhf_RA4NHY.dat +++ b/RSSI/RSSI_gm340uhf_RA4NHY.dat @@ -1,10 +1,10 @@ -#Data to RSSI.dat by RA4NHY +#The data to RSSI.dat by RA4NHY #Values in the RSSI.dat file are obtained using the MMDVMCal calibration program (S mode), the high-frequency generator and the Motorola GM340UHF radio station. #For different radio stations, the values are slightly different. #For example, for those GM340 that I had, the discrepancy is about 10 dB. #Therefore, it is desirable to carry out calibration for each radio station. #More about RSSI and a homebrew MMDVM node you can read here https://drive.google.com/file/d/0B_UNZTdPtyZUUjN2d2llV0RtNTQ/view but unfortunately in Russian only -#Ivan, RA4NHY +#Anton, RA4NHY 1045 -43 1043 -46 From 2e345aad3867620bb117edbed59ab834041e9869 Mon Sep 17 00:00:00 2001 From: Sergei Date: Thu, 16 Mar 2017 14:07:11 +0300 Subject: [PATCH 5/5] some small editing to get data in right format some small editing to get data in right format --- DMRIDUpdateBM.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/DMRIDUpdateBM.sh b/DMRIDUpdateBM.sh index bc40817..9007e41 100644 --- a/DMRIDUpdateBM.sh +++ b/DMRIDUpdateBM.sh @@ -91,7 +91,13 @@ then fi # Generate new file -curl 'http://registry.dstar.su/dmr/DMRIds.php' 2>/dev/null > ${DMRIDFILE} +wget http://registry.dstar.su/dmr/DMRIds.php -O DMRIds-temp1.dat +cat DMRIds-temp1.dat | sed -e 's/ /\t\t/g' > DMRIds-temp2.dat +cat DMRIds-temp2.dat | sed -e 's/\t/ /g' > DMRIds-temp3.dat +cat DMRIds-temp3.dat | sed -e 's/ / /g' > DMRIds.dat +rm -f DMRIds-temp1.dat +rm -f DMRIds-temp2.dat +rm -f DMRIds-temp3.dat # Restart MMDVMHost eval ${RESTARTCOMMAND}