better script protections

pull/1/head
Tom Early 6 years ago
parent a198706125
commit ccb4e6e960

@ -128,7 +128,7 @@ do
ps -aux | grep -e xlxd -e xrfd -e ambed | grep -v grep ps -aux | grep -e xlxd -e xrfd -e ambed | grep -v grep
fi fi
echo echo
echo " Reflector Administration, Version #200713" echo " Reflector Administration, Version #200715"
echo echo
echo "ls : List the configuration file" echo "ls : List the configuration file"
echo "cl : Clean (remove) compiled objects and executables" echo "cl : Clean (remove) compiled objects and executables"
@ -176,18 +176,29 @@ do
cat reflector.cfg; cat reflector.cfg;
echo echo
read -p "<Enter> to return to main menu: " ans read -p "<Enter> to return to main menu: " ans
elif [[ "$key" == us* ]]; then UninstallReflector elif [[ "$key" == us* ]]; then
elif [[ "$key" == is* ]]; then InstallReflector if [[ "$callsign" == XLX* ]] && [ -e $xlxserv ]; then
UninstallReflector
elif [[ "$callsign" == XRF* ]] && [ -e $xrfserv ]; then
UninstallReflector
fi
elif [[ "$key" == is* ]]; then
if [[ "$callsign" == XLX* ]] && [ -e src/xlxd ] && [ ! -e $xlxserv ] && [ ! -e $xrfserv ]; then
InstallReflector
elif [[ "$callsign" == XRF* ]] && [ -e src/xrfd ] && [ ! -e $xlxserv ] && [ ! -e $xrfserv ]; then
InstallReflector
fi
elif [[ "$key" == gp* ]]; then git pull elif [[ "$key" == gp* ]]; then git pull
elif [[ "$key" == rr* ]]; then elif [[ "$key" == rr* ]]; then
if [[ "$callsign" == XLX* ]] if [[ "$callsign" == XLX* ]] && [ -e $xlxserv ]; then
then sudo systemctl restart xlxd sudo systemctl restart xlxd
else sudo systemctl restart xrfd elif [[ "$callsign" == XRF* ]] && [ -e $xrfserv ]; then
sudo systemctl restart xrfd
fi fi
elif [[ "$key" == rt* ]]; then sudo systemctl restart ambed elif [[ "$key" == rt* ]] && [ -e $ambserv ]; then sudo systemctl restart ambed
elif [[ "$key" == cl* ]]; then Clean elif [[ "$key" == cl* ]]; then Clean
elif [[ "$key" == co* ]]; then Compile elif [[ "$key" == co* ]]; then Compile
elif [[ "$key" == tl* ]]; then sudo journalctl -u ambed -f elif [[ "$key" == tl* ]] && [ -e $ambserv ]; then sudo journalctl -u ambed -f
elif [[ "$key" == rl* ]]; then elif [[ "$key" == rl* ]]; then
if [ -e $xlxserv ]; then if [ -e $xlxserv ]; then
sudo journalctl -u xlxd -f sudo journalctl -u xlxd -f

@ -183,6 +183,8 @@ srch='src/configure.h'
srcm='src/configure.mk' srcm='src/configure.mk'
ambh='ambed/configure.h' ambh='ambed/configure.h'
ambm='ambed/configure.mk' ambm='ambed/configure.mk'
xlxserv='/etc/systemd/system/xlxd.service'
xrfserv='/etc/systemd/system/xrfd.service'
# default values # default values
callsign_d='CHNGME' callsign_d='CHNGME'
nummod_d=26 nummod_d=26
@ -199,13 +201,28 @@ else
echo 'No configuration file found...' echo 'No configuration file found...'
sleep 1 sleep 1
fi fi
if [ -e $xlxserv ] || [ -e $xrfserv ]; then
echo -n "You cannot change the configuration right now beacuse there is an "
if [ -e $xlxserv ]; then
echo "XLX server running."
else
echo "XRF server running."
fi;
echo "===========${rcfg}============="
cat $rcfg
echo
echo "Please use radmin to uninstall the running server before attempting to modify the configuration."
exit 1
fi
key='x' key='x'
# main loop # main loop
while [[ "$key" != q* ]] while [[ "$key" != q* ]]
do do
clear clear
echo echo
echo " Reflector Configuration, Version #200713" echo " Reflector Configuration, Version #200715"
echo echo
echo -n "cs : Reflector Callsign = "; EvaluateVar callsign{,_d} echo -n "cs : Reflector Callsign = "; EvaluateVar callsign{,_d}
echo -n "nm : Number of Modules = "; EvaluateVar nummod{,_d} echo -n "nm : Number of Modules = "; EvaluateVar nummod{,_d}

Loading…
Cancel
Save

Powered by TurnKey Linux.