I had to add the echo lines to give me feedback as to why it would not start
The following is just me ranting.
I have fixed the following issues so that my script runs just fine
# if dstarrepeater is configured or running, dont start this daemon!
! test -r /etc/dstar-radio.dstarrepeater || exit 1
//// This rule is ignored as I don't use d-star
########################################################
if [[ $(egrep -h -i "1234567|M1ABC" ${CONFIG} | wc -l) -gt 0 ]]; then
echo "Invalid ID" //Added for test results
exit 1;
fi
////
CONFIG=/etc/dmrgateway
why are we searching for M1ABC in dmrgateway
My DMRGateway failed to start because I had ID=1234567 in Network 3 that was disabled
This is a generic search that will fail the script if either 1234567 is found anywhere in the file
why is the DMR Network not allowed to start because of a disabled network config. ??????
The following block of code tests for the id 1234567 only in enabled networks of /etc/dmrgateway
for i in {1..5};do
m1=$(sed -nr "/^\[DMR Network $i\]/ { :l /^Enabled[ ]*=/ { s/.*=[ ]*//; p; q;}; n; b l;}" /etc/dmrgateway )
m2=$(sed -nr "/^\[DMR Network $i\]/ { :l /^Id[ ]*=/ { s/.*=[ ]*//; p; q;}; n; b l;}" /etc/dmrgateway )
if [ "$m1" == "1" ] && [ "$m2" == "1234567" ]; then
echo "Network $i Failed Test"
fi
done
############################################################################
# Make sure DMR Networking is on
if [ `sed -n '/\[DMR Network\]/{n;p;}' /etc/mmdvmhost | cut -c 8` == 0 ]; then
echo "DMR Network not Enabled in /etc/mmdvmhost" //Added for test results
exit 1;
fi
/////////// This one makes sense except if enable is not the first line after the header it fails
why not use a line independent test like the following
if [ 'sed -nr "/^\[DMR Network\]/ { :l /^Enable[ ]*=/ { s/.*=[ ]*//; p; q;}; n; b l;}" /etc/mmdvmhost '=="0" ]; then
######################################################################################
# Make sure I am supposed to be used
if [ `sed -n '/\[DMR Network\]/{n;p;n;p;}' /etc/mmdvmhost | sed '1d' | awk -F = '{print $2}'` != 127.0.0.1 ]; then
echo " Invalid Address in /etc/mmdvmhost, DMR Network" // Added for test results
exit 1;
fi
///////// Again this test for address 127.0.0.1 makes sense. except if address is not the second line after the header it

Why not use line independent code like the following
if [ 'sed -nr "/^\[DMR Network\]/ { :l /^Address[ ]*=/ { s/.*=[ ]*//; p; q;}; n; b l;}" /etc/mmdvmhost '=="127.0.0.1" ]; then
##################################################################################################
# Reconfigure to use old style service if the config is not ready
#if [[ $(grep -c "\[DMR Network 3\]" /etc/dmrgateway) -eq "0" ]]; then
# DAEMON=DMRGateway_old
#fi
//////// I don't use Network 3 . It is always disabled as this is reconfigured by the dashboard configuration for HBLink, DMR2YSF, DMR2NXDN and it tries to use and old DMRGateway_old that does not exist if enable = 0
If Network 3 is not configured for one of these, pi-star configuration turns off Network 3 - ????????
Therefore I had to comment out the whole rule
######################################################################################################
in the original file, there was No feedback as to why the script failed to start the DMRGateway
I have not looked at the other service startups, but I suspect similar coding.
Phil VE3RD