Update DMRIDUpdate.sh
In case of dmr-marc.net server unresponsive, DMRIDs.dat is not overwritten with an empty file.
This commit is contained in:
parent
a50854d67a
commit
ce467c91ba
1 changed files with 11 additions and 3 deletions
|
@ -48,8 +48,9 @@
|
||||||
#
|
#
|
||||||
# CONFIGURATION
|
# CONFIGURATION
|
||||||
#
|
#
|
||||||
# Full path to DMR ID file
|
# Full path to DMR ID file, without final slash
|
||||||
DMRIDFILE=/path/to/DMR/ID/file/DMRIds.dat
|
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)
|
# How many DMR ID files do you want backed up (0 = do not keep backups)
|
||||||
DMRFILEBACKUP=1
|
DMRFILEBACKUP=1
|
||||||
|
@ -90,7 +91,14 @@ then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Generate new file
|
# 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
|
# Restart MMDVMHost
|
||||||
eval ${RESTARTCOMMAND}
|
eval ${RESTARTCOMMAND}
|
||||||
|
|
Loading…
Reference in a new issue