mirror of https://gitlab.com/hp3icc/emq-TE1.git
Update data-mmdvm.sh
This commit is contained in:
parent
6bc38c9ac6
commit
dedf9ac2d3
|
|
@ -8,6 +8,7 @@ echo "Inicio: $SCRIPT_NAME" >> /opt/curl.txt
|
||||||
cat > /opt/data-mmdvm.py <<- "EOFXC"
|
cat > /opt/data-mmdvm.py <<- "EOFXC"
|
||||||
import os
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
|
import re
|
||||||
|
|
||||||
APRSHOSTS = "/opt/data-files/APRSHosts.txt"
|
APRSHOSTS = "/opt/data-files/APRSHosts.txt"
|
||||||
DCSHOSTS = "/opt/data-files/DCS_Hosts.txt"
|
DCSHOSTS = "/opt/data-files/DCS_Hosts.txt"
|
||||||
|
|
@ -87,8 +88,18 @@ for dest_file, source_url in files_to_generate:
|
||||||
subprocess.run(['curl', '--fail', '-o', dest_file, '-s', source_url])
|
subprocess.run(['curl', '--fail', '-o', dest_file, '-s', source_url])
|
||||||
|
|
||||||
# Additional step for DMRId.dat
|
# Additional step for DMRId.dat
|
||||||
subprocess.run(['wget', '-O', DMRIDFILE_ALTERNATE, "http://datafiles.ddns.net:8888/DMRIds.dat"])
|
subprocess.run(['cp', DMRIDFILE, DMRIDFILE_ALTERNATE]) # Correcting the 'cp' command
|
||||||
subprocess.run(['sed', '-i', 's/,.*//; s/ */ /g; s/^\(\S\+\s\S\+\s\S\+\).*$/\1/', DMRIDFILE_ALTERNATE])
|
|
||||||
|
# Realizando el reemplazo utilizando Python (sin sed)
|
||||||
|
with open(DMRIDFILE_ALTERNATE, 'r') as file:
|
||||||
|
content = file.read()
|
||||||
|
|
||||||
|
# Realizar el reemplazo usando una expresión regular
|
||||||
|
content = re.sub(r'^([^,]+),([^,]+),([^,]+).*', r'\1 \2 \3', content, flags=re.M)
|
||||||
|
|
||||||
|
# Escribir el contenido modificado de vuelta al archivo
|
||||||
|
with open(DMRIDFILE_ALTERNATE, 'w') as file:
|
||||||
|
file.write(content)
|
||||||
|
|
||||||
# Fix up ircDDBGateway Host Files on v4
|
# Fix up ircDDBGateway Host Files on v4
|
||||||
if os.path.exists("/opt/data-files/ircddbgateway"):
|
if os.path.exists("/opt/data-files/ircddbgateway"):
|
||||||
|
|
@ -137,8 +148,6 @@ while true; do
|
||||||
sleep 60 # Espera 1 minuto antes de la próxima verificación
|
sleep 60 # Espera 1 minuto antes de la próxima verificación
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
EOFXE
|
EOFXE
|
||||||
chmod +x /opt/mmvm.sh
|
chmod +x /opt/mmvm.sh
|
||||||
cat > /lib/systemd/system/data-mmdvm.service <<- "EOFXD"
|
cat > /lib/systemd/system/data-mmdvm.service <<- "EOFXD"
|
||||||
|
|
@ -170,3 +179,5 @@ fi
|
||||||
(crontab -l | grep -v "python3 /opt/data-mmdvm.py") | crontab -
|
(crontab -l | grep -v "python3 /opt/data-mmdvm.py") | crontab -
|
||||||
# Registra el final en /opt/curl.txt
|
# Registra el final en /opt/curl.txt
|
||||||
echo "Finalizado: $SCRIPT_NAME" >> /opt/curl.txt
|
echo "Finalizado: $SCRIPT_NAME" >> /opt/curl.txt
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue