Skip to content

Commit

Permalink
Update DMRIDUpdate.sh
Browse files Browse the repository at this point in the history
In case of dmr-marc.net server unresponsive, DMRIDs.dat is not overwritten with an empty file.
  • Loading branch information
IZ7BOJ authored Apr 5, 2018
1 parent a50854d commit ce467c9
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions linux/DMRIDUpdate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,9 @@
#
# CONFIGURATION
#
# Full path to DMR ID file
DMRIDFILE=/path/to/DMR/ID/file/DMRIds.dat
# Full path to DMR ID file, without final slash
DMRIDPATH=/path/to/DMR/ID/file
DMRIDFILE=${DMRIDPATH}/DMRIds.dat
#
# How many DMR ID files do you want backed up (0 = do not keep backups)
DMRFILEBACKUP=1
Expand Down Expand Up @@ -90,7 +91,14 @@ then
fi

# Generate new file
curl 'http://dmr-marc.net/cgi-bin/trbo-database/datadump.cgi?table=users&format=csv&header=0' 2>/dev/null | sed -e 's/\t//g' | awk -F"," '/,/{gsub(/ /, "", $2); printf "%s\t%s\t%s\n", $1, $2, $3}' | sed -e 's/\(.\) .*/\1/g' > ${DMRIDFILE}
curl 'http://dmr-marc.net/cgi-bin/trbo-database/datadump.cgi?table=users&format=csv&header=0' 2>/dev/null | sed -e 's/\t//g' | awk -F"," '/,/{gsub(/ /, "", $2); printf "%s\t%s\t%s\n", $1, $2, $3}' | sed -e 's/\(.\) .*/\1/g' > ${DMRIDPATH}/DMRIds.tmp
if [ -s ${DMRIDPATH}/DMRIds.tmp ]
then
mv ${DMRIDPATH}/DMRIds.tmp ${DMRIDFILE}
else
echo " ERROR during file update "
rm ${DMRIDPATH}/DMRIds.tmp
fi

# Restart MMDVMHost
eval ${RESTARTCOMMAND}

0 comments on commit ce467c9

Please sign in to comment.