diff --git a/scripts/install-linker.sh b/scripts/install-linker.sh new file mode 100644 index 0000000..636d7a4 --- /dev/null +++ b/scripts/install-linker.sh @@ -0,0 +1,21 @@ +#!/bin/bash + + + + +cd / +rm -rf DMRGa* +cd /opt +rm -rf script +cd /var/log +rm -rf script + +cd /boot +cp DMRGateway*.tgz / +cd / +tar -xvf DMRGateway*.tgz +systemctl daemon-reload +echo -n "" > /var/log/script/static-slot1.txt +echo -n "" > /var/log/script/static-slot2.txt +echo -n "" > /var/log/script/slot1.txt +echo -n "" > /var/log/script/slot2.txt diff --git a/scripts/lib/systemd/system/relinker.service b/scripts/lib/systemd/system/relinker.service index bd91ae7..69cb9a4 100644 --- a/scripts/lib/systemd/system/relinker.service +++ b/scripts/lib/systemd/system/relinker.service @@ -5,7 +5,9 @@ After=multi-user.target [Service] Type=idle -ExecStart=/bin/bash /opt/script/relink-repeater.sh >> /var/log/script/checkBMAPI.log 2>&1 +ExecStart=/bin/bash /opt/script/relink-repeater.sh + + [Install] diff --git a/scripts/lib/systemd/system/relinkerhot.service b/scripts/lib/systemd/system/relinkerhot.service index 4848676..4331bf1 100644 --- a/scripts/lib/systemd/system/relinkerhot.service +++ b/scripts/lib/systemd/system/relinkerhot.service @@ -5,7 +5,7 @@ After=multi-user.target [Service] Type=idle -ExecStart=/bin/bash /opt/script/relink-hotspot.sh >> /var/log/script/checkBMAPI.log 2>&1 +ExecStart=/bin/bash /opt/script/relink-hotspot.sh [Install] diff --git a/scripts/opt/script/README b/scripts/opt/script/README index e4865b7..b0e5eb2 100644 --- a/scripts/opt/script/README +++ b/scripts/opt/script/README @@ -4,7 +4,7 @@ DMR SUDO Reflector - TG -This is the first release version of the relinker scripts 3.1 +This is the first release version of the relinker scripts 3.2 @@ -48,7 +48,7 @@ Port=3769 -1. Copy the package DMRGateway-TGDynRewrite-relinker-3.1.tgz to the folder/boot and also the install-relinker.sh script supplied (you can do this with a card reader from windows if you like) +1. Copy the package DMRGateway-TGDynRewrite-relinker-3.2.tgz to the folder/boot and also the install-relinker.sh script supplied (you can do this with a card reader from windows if you like) 2. run /boot#./install-relinker which should create folders /opt/script/script and /var/log/script/various working files and logfile. it also sets up services in systemd diff --git a/scripts/opt/script/install-relinker.sh b/scripts/opt/script/install-relinker.sh deleted file mode 100644 index 0bb8850..0000000 --- a/scripts/opt/script/install-relinker.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash - - - - -cd / -rm -rf DMRGa* -cd /opt -rm -rf script -cd /var/log -rm -rf script - -cd /boot -cp DMRGateway*.tgz / -cd / -tar -xvf DMRGateway*.tgz -systemctl daemon-reload diff --git a/scripts/opt/script/relink-hotspot.sh b/scripts/opt/script/relink-hotspot.sh index 4221849..c175e9a 100644 --- a/scripts/opt/script/relink-hotspot.sh +++ b/scripts/opt/script/relink-hotspot.sh @@ -3,6 +3,14 @@ source /opt/script/script.conf +exec 3>&1 4>&2 +trap 'exec 2>&4 1>&3' 0 1 2 3 +exec 1>/var/log/script/checkBMAPI.log 2>&1 + + + + + #check BM API @@ -121,7 +129,8 @@ check_if_nothing_linked_slot2(){ } - +while : +do check_BM_API echo $checkslot1 @@ -129,10 +138,5 @@ $checkslot2 $slot1notlinked $slot2notlinked echo -sleep $slowdown -/bin/bash /opt/script/relink-hotspot.sh >> /var/log/script/checkBMAPI.log 2>&1 - - - - - +sleep $slowdown +done \ No newline at end of file diff --git a/scripts/opt/script/relink-repeater.sh b/scripts/opt/script/relink-repeater.sh index d333513..6700195 100644 --- a/scripts/opt/script/relink-repeater.sh +++ b/scripts/opt/script/relink-repeater.sh @@ -3,6 +3,13 @@ source /opt/script/script.conf +exec 3>&1 4>&2 +trap 'exec 2>&4 1>&3' 0 1 2 3 +exec 1>/var/log/script/checkBMAPI.log 2>&1 + + + + #check BM API @@ -122,6 +129,9 @@ check_if_nothing_linked_slot2(){ } + +while : +do check_BM_API echo $checkslot1 @@ -129,6 +139,5 @@ $checkslot2 $slot1notlinked $slot2notlinked echo -sleep $slowdown -/bin/bash /opt/script/relink-repeater.sh >> /var/log/script/checkBMAPI.log 2>&1 - +sleep $slowdown +done diff --git a/scripts/opt/script/script.conf b/scripts/opt/script/script.conf index ab1bbf4..8736739 100644 --- a/scripts/opt/script/script.conf +++ b/scripts/opt/script/script.conf @@ -1,14 +1,14 @@ #!/usr/bin/bash -repeater=234587501 -call=M0VUB -defaultslot1=0 -defaultslot2=2350 +repeater=235192 +call=GB3IN +defaultslot1=23590 +defaultslot2=91 minrelinktimerslot1=30 minrelinktimerslot2=30 -slowdown=10 -checkslot1= +slowdown=0 +checkslot1=check_status_slot1 checkslot2=check_status_slot2 -slot1notlinked= +slot1notlinked=check_if_nothing_linked_slot1 slot2notlinked=check_if_nothing_linked_slot2 #configuration above enabled to watch slot 2 only on a hotspot diff --git a/scripts/opt/script/start.sh b/scripts/opt/script/start.sh index c56a620..5caca19 100644 --- a/scripts/opt/script/start.sh +++ b/scripts/opt/script/start.sh @@ -6,7 +6,10 @@ sleep 1 cd /var/log/script sleep 1 tar -xvf var-log-script.tgz - +echo -n "" > /var/log/script/static-slot1.txt +echo -n "" > /var/log/script/static-slot2.txt +echo -n "" > /var/log/script/slot1.txt +echo -n "" > /var/log/script/slot2.txt diff --git a/scripts/opt/script/var-log-script.tgz b/scripts/opt/script/var-log-script.tgz index 7f5a7fc..cac2dfb 100644 Binary files a/scripts/opt/script/var-log-script.tgz and b/scripts/opt/script/var-log-script.tgz differ diff --git a/scripts/var/log/script/test1.txt b/scripts/var/log/script/test1.txt index 4f60d09..e69de29 100644 --- a/scripts/var/log/script/test1.txt +++ b/scripts/var/log/script/test1.txt @@ -1 +0,0 @@ -{"reflector":{"reflector":0,"interval":0,"active":4000},"blockedGroups":[],"staticSubscriptions":[{"talkgroup":91,"networkid":2341,"repeaterid":235192,"slot":2,"type":"tarantool"},{"talkgroup":23590,"networkid":2341,"repeaterid":235192,"slot":1,"type":"tarantool"}],"dynamicSubscriptions":[],"timedSubscriptions":[],"clusters":[]} \ No newline at end of file diff --git a/scripts/var/log/script/var-log-script.tgz b/scripts/var/log/script/var-log-script.tgz deleted file mode 100644 index 7f5a7fc..0000000 Binary files a/scripts/var/log/script/var-log-script.tgz and /dev/null differ