Update nodemgmt-scripts.sh

This commit is contained in:
2019-01-27 22:30:08 -06:00
parent 8601ac572b
commit 7beef2532d

View File

@@ -9,67 +9,20 @@ source /opt/idssys/nodemgmt/settings.conf
source /opt/idssys/defaults/colors.inc
source /opt/idssys/defaults/default.inc
node_hosts=`mysql -u sqluser -pdcs2057 -s -N -e "SELECT value FROM idssys.nodemgmt WHERE var = 'node_hosts'"`
NODE_HOSTS=`mysql -u sqluser -pdcs2057 -s -N -e "SELECT value FROM idssys.nodemgmt WHERE var = 'NODE_HOSTS'"`
IFS=,
node_hosts=(${node_hosts})
NODE_HOSTS=(${NODE_HOSTS})
unset IFS
# ========================================================= #
MAIN_MENU() {
while :
do
clear
echo ""
echo -e "${idsCL[LightGreen]} NodeMgmt - Galera/NGINX Node Management${idsCL[Default]} ${idsCL[DarkGray]}(ver-${VERS})${idsCL[Default]}"
echo -e "${idsCL[LightGreen]}-------------------------------------------------------------${idsCL[Default]}"
echo -e "Node hostname: ${node_hostname}"
echo -e "${idsCL[LightGreen]}-------------------------------------------------------------${idsCL[Default]}"
echo ""
echo " [1] Change Backup Location"
echo " [2] Change MySQL User"
echo " [3] Change MySQL Password"
echo " [4] Change MySQL Config File Location"
echo " [5] Change The Number of Backup Days to Keep"
echo ""
echo " [B] Run Backup"
echo " [L] List Backups"
echo " [D] Delete Backups"
echo ""
echo " [C] Add Crontab Entry to run every 3 Hours"
echo -e " ${idsCL[DarkGray]}(edit crontab manually to adjust the backup frequency)${idsCL[Default]}"
echo ""
echo " [Q] Quit"
echo ""
echo ""
echo -e -n "${idsCL[LightYellow]}Please select an [ActionItem] from above:${idsCL[Default]} "
read -n 1 opt
echo ""
case $opt in
1) WEBMIN_INSTALL
INSTALL_MENU;;
2) GLANCES_INSTALL
INSTALL_MENU;;
3) X11VNC_INSTALL
INSTALL_MENU;;
4) FW_INSTALL
INSTALL_MENU;;
5) LINUPX_UNINSTALL
INSTALL_MENU;;
[Bb]) RUN_BACKUP;;
[Ll]) LIST_BACKUPS;;
[Dd]) DELETE_MENU;;
[Cc]) ADD_CRONTAB;;
[Qq]) EXIT1
exit 1;;
*) echo "Thats an invaild option,";
echo "please select a valid option only.";
sleep 1;;
esac
done
}
echo ""
echo -e "${idsCL[LightGreen]} NodeMgmt - Galera/NGINX Node Management${idsCL[Default]} ${idsCL[DarkGray]}(ver-${VERS})${idsCL[Default]}"
echo -e "${idsCL[LightGreen]}-------------------------------------------------------------${idsCL[Default]}"
echo -e "Node hostname: ${node_hostname}"
echo -e "${idsCL[LightGreen]}-------------------------------------------------------------${idsCL[Default]}"
echo ""
case "$1" in
service)
@@ -84,7 +37,7 @@ case "$1" in
echo -e "${idsCL[LightGreen]}-------------------------------------------${idsCL[Default]}"
nid=1
for nip in "${node_hosts[@]}"
for nip in "${NODE_HOSTS[@]}"
do
echo -en "${STA}ing Node ${nid} ($nip)...${idsCL[Default]}"
ssh root@${nip} systemctl $3 $2