Updated script files.

This commit is contained in:
Jonathan Naylor
2020-04-22 17:47:33 +01:00
parent 4ed53d9bab
commit bd0de76f86
8 changed files with 166 additions and 37 deletions

View File

@@ -0,0 +1,12 @@
[Unit]
Description=relinker service
After=multi-user.target
[Service]
Type=idle
ExecStart=/bin/bash /opt/script/relink-repeater.sh >> /var/log/script/checkBMAPI.log 2>&1
[Install]
WantedBy=multi-user.target

View File

@@ -0,0 +1,12 @@
[Unit]
Description=relinkerhot service
After=multi-user.target
[Service]
Type=idle
ExecStart=/bin/bash /opt/script/relink-hotspot.sh >> /var/log/script/checkBMAPI.log 2>&1
[Install]
WantedBy=multi-user.target

View File

@@ -1,8 +1,14 @@
DMR SUDO Reflector - TG
This is the first release version of the relinker scripts 3.1
These scripts are supplied as is and work in conjuction with DMRGateway Mid April 2020 Onwards .....If you don't understand the notes ask someone who does please
@@ -40,33 +46,62 @@ Enabled=1
Port=3769
copy the package DMRGateway-TGDynRewrite-relinker-2.0.tgz to the folder / unpack with tar -xvf packagename which should create folders /opt/script/script runtimes and /var/log/script/various working files and log
configure the config file /opt/script/script.conf call repeater=235??? ID with your default slots and dont forget to set these static via BM selfcare also min relink timer minrelinktimer in seconds
this is the time before reconnection on a slot after someone finishes and either the slot is unlinked by the user or the dynamic times out
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)
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
ready to run the script required
3. Edit the config file /opt/script/script.conf repeater=235??? ID call callsign your defaults for slot linking
also min relink timer minrelinktimer in seconds this is the time before reconnection on a slot after someone finishes RF and either the slot is unlinked by the user
or the dynamic times out i.e BM timer
it waits a further minlinktimer seconds before relinking
slowdown=10 This is higher for faster rasp pi 10 for pi 3B + or 1 for original Pi B
checkslot1=check_status_slot1
checkslot2=check_status_slot2
slot1notlinked=check_if_nothing_linked_slot1
slot2notlinked=check_if_nothing_linked_slot2
Above checks all slots default for repeater with prefered config SUDO Reflectors both slots ............if in doubt include all these lines !!!!
checkslot1=
checkslot2=check_status_slot2
slot1notlinked=
slot2notlinked=check_if_nothing_linked_slot2
Above checks only slot 2 typically a hotspot........ or a repeater that only has SUDO Reflectors enabled in DMRGateway on one of the slots
............if in doubt include all these lines in first example!!!!
4. Don't forget to set these static via Brandmeister selfcare
Add the following line to crontab on the rasp pi you dont need to do anything else just save crontab and exit
5. Add the following line to crontab on the rasp pi you dont need to do anything else just save crontab and exit
17 * * * * root echo -n "" > /var/log/script/checkBMAPI.log
Add one of the following to etc/rc.local right at end just before exit 0
/opt/script/./run-relinker.sh
or
/opt/script/./run-relinker-hotspot.sh
pi-star additional step
6. Pi-star additional step
Also in same file etc/rc.local
@@ -88,9 +123,57 @@ if [ ! -d /var/log/script ]; then
fi
7. start one of the services with following command
choose either Repeater
systemctl start relinker.service
or Hotspot ?
systemctl start relinkerhot.service
systemctl status relinker.service
or
systemctl status relinkerhot.service
will show if its running if it is running ?
you can tail the log file at the command prompt
tail -f /var/log/script/checkBMAPI.log
once it is confirmed running and working
enable the service you chose to enable automatically at boot example
systemctl enable relinker.service
for repeater
or
systemctl enable relinkerhot.service
for hotspot
reboot
once you have rebooted check all is auto starting
you can tail the log file at the command prompt

View File

@@ -1,11 +1,17 @@
#!/bin/bash
cp DMRG*.tgz /
cd /
rm -rf DMRGa*
cd /opt
rm -rf script
cd /var/log
rm -rf script
tar -xvf DMRG*
cd /boot
cp DMRGateway*.tgz /
cd /
tar -xvf DMRGateway*.tgz
systemctl daemon-reload

View File

@@ -24,7 +24,7 @@ check_BM_API(){
#sed -n -e 's/^.*slot":2,"timeout"://p' /var/log/script/test3.txt > /var/log/script/test4.txt
sed -n -e 's/^.*slot":0,"timeout"://p' /Var/log/script/test3.txt > /var/log/script/test4.txt
sed -n -e 's/^.*slot":0,"timeout"://p' /var/log/script/test3.txt > /var/log/script/test4.txt
sed 's/},{"repeaterid.*//' /var/log/script/test4.txt > /var/log/script/slot2.txt
@@ -124,11 +124,14 @@ check_if_nothing_linked_slot2(){
check_BM_API
echo
#check_status_slot1
check_status_slot2
#check_if_nothing_linked_slot1
check_if_nothing_linked_slot2
echo
$checkslot1
$checkslot2
$slot1notlinked
$slot2notlinked
echo
sleep $slowdown
/bin/bash /opt/script/relink-hotspot.sh >> /var/log/script/checkBMAPI.log 2>&1

View File

@@ -124,12 +124,11 @@ check_if_nothing_linked_slot2(){
check_BM_API
echo
check_status_slot1
check_status_slot2
check_if_nothing_linked_slot1
check_if_nothing_linked_slot2
echo
$checkslot1
$checkslot2
$slot1notlinked
$slot2notlinked
echo
sleep 5
#/opt/script/./check.sh >> /var/log/script/checkBMAPI.log
sleep $slowdown
/bin/bash /opt/script/relink-repeater.sh >> /var/log/script/checkBMAPI.log 2>&1

View File

@@ -1,7 +1,20 @@
#!/usr/bin/bash
repeater=235192
call=GB3IN
defaultslot1=23590
defaultslot2=91
repeater=234587501
call=M0VUB
defaultslot1=0
defaultslot2=2350
minrelinktimerslot1=30
minrelinktimerslot2=30
slowdown=10
checkslot1=
checkslot2=check_status_slot2
slot1notlinked=
slot2notlinked=check_if_nothing_linked_slot2
#configuration above enabled to watch slot 2 only on a hotspot
# add the lines as required you may only have 1 slot monitored on a repeater if thats
# all using SUDO Reflectors Cant imagine why

View File

@@ -0,0 +1 @@
{"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":[]}