Add initial control scripts.. Will edit later to talor for HBL

This commit is contained in:
ShaYmez 2023-01-02 18:46:50 +00:00
parent 961a14a405
commit e9936f68ca
7 changed files with 457 additions and 0 deletions

114
usr/local/sbin/flush Executable file
View File

@ -0,0 +1,114 @@
#!/bin/bash
# OBP-MASTER FORMERLY RYSEN MASTER+ (HBlink3) A FORK OF THE FREEDMR / HBLINK PROJECT
# This script written by Shane Daley M0VUB. The script gracefully shutsdown services while services are cleaned and logs are truncated.
# We can also add items in this script for future use like updates or further log trims.
# Add to the cron tab for auto execution
# Copyright (C) 2020 Shane P, Daley M0VUB <support@gb7nr.co.uk>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# Start service clean/truncate/ and restart of services.
echo "Stopping services....."
sleep 2
echo "Stopping OBP MasterServer (If not already stopped)...."
cd /etc/hblink3
docker-compose down
echo "Done."
sleep 1
echo "Stopping HBMonitor....."
systemctl stop hbmon
echo "Done."
sleep 1
echo "OBP MasterServer Flush and maintenance loop starting....."
sleep 1
echo "Starting truncate main log folder /var/log....."
truncate -s 0 /var/log/*log
echo "Starting truncate OBP entire log /var/log/hblink....."
truncate -s 0 /var/log/hblink/*log &&
echo "Starting truncate Lastheard....."
truncate -s 0 /opt/HBmonitor/log/*log
echo "Flushing JSON files....."
echo "/etc/hblink3/json....."
rm /etc/hblink3/json/peer_ids.json
rm /etc/hblink3/json/subscriber_ids.json
#Get JSON files..
curl https://freestar.network/downloads/subscriber_ids.json -o /etc/hblink3/json/subscriber_ids.json
curl https://freestar.network/downloads/peer_ids.json -o /etc/hblink3/json/peer_ids.json
echo "JSON files will be downloaded from freestar.network....."
figlet "FreeSTAR CL OBP V1.9"
#Restart all services gracefully
echo "Restart all services....."
sleep 1
echo "Restarting docker app....."
systemctl restart docker
echo "Done."
sleep 1
echo "Restart apache2....."
systemctl restart apache2
echo "Done."
sleep 1
echo "Starting OBP MasterServer....."
sleep 1
echo .
sleep 1
echo ..
sleep 1
echo ...
docker-compose up -d
sleep 1
figlet "OBP Master."
sleep 1
echo "Checking OBP is composed....."
sleep 1
docker ps
sleep 3
echo "Checking startup error logs....."
docker container logs hblink
echo "Done."
echo "Flushing network tracking table....."
conntrack -F
sleep 1
echo "Starting HBmonitor....."
systemctl restart hbmon
figlet "HBmonitor3"
echo "Done."
sleep 1
echo "Done. Now Exiting....."
sleep 1
echo .
sleep 1
echo ..
sleep 1
echo ...
echo "OBP MasterServer is now online. Flush is complete and you may now exit. AKA ShaYmez."
#
# This script has been developed by the one and only ShaYmez. Visit https://repo.radio/ShaYmez for more super scripts!
echo "All systems have been flushed/cleaned and ready to go. Aka Dr. Node. ShaYmez, OBP MasterServer"

70
usr/local/sbin/menu Executable file
View File

@ -0,0 +1,70 @@
#!/bin/bash
# HBLINK3 OBP MASTER Configuration menu DO-NOT-ALTER THIS FILE!!!!!!!!!!
# SYSTEM-X FORMERLY RYSEN MASTER+ (HBlink3) A FORK OF THE FREEDMR / HBLINK PROJECT
# This script written by Shane Daley M0VUB. The script gracefully shutsdown services while services are cleaned and logs are truncated.
# We can also add items in this script for future use like updates or further log trims.
# Add to the cron tab for auto execution
# Copyright (C) 2020 Shane P, Daley M0VUB <support@gb7nr.co.uk>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# Main MENU system.....
while : ; do
menuopt=$(whiptail --title "HBlink3 OBPMaster Control Version 1.9CL" --menu "Select option by using the up and down arrows on your keyboard. Once selected please press enter:" 23 56 13 \
1 " Restart OBPMaster " \
2 " Stop OBPMaster " \
3 " Start OBPMaster " \
4 " Hard Flush OBPMaster " \
5 " Soft Flush OBPMaster (Not Used) " \
6 " Edit Configuration " \
7 " Edit rules.py " \
8 " Update OBPMaster " \
9 " Full Upgrade OBPMaster " \
10 " Update Operating System " \
11 " Reboot Entire Server " 3>&1 1>&2 2>&3)
exitstatus=$?
# Back-end rysen menu
#exitstatus=$?
if [ $exitstatus = 0 ]; then
echo "You have chosen option:" $menuopt
else
echo "Type 'menu' to start HBlink3 OBPMaster Control Menu "; break;
fi
# Action
case $menuopt in
1)
/usr/bin/hblink-restart ;;
2)
/usr/bin/hblink-stop ;;
3)
/usr/bin/hblink-start ;;
4)
/usr/bin/hblink-flush ;;
5)
/usr/bin/hblink-soft-flush ;;
6)
sudo nano /etc/hblink3/hblink.cfg ;;
7)
sudo nano /etc/hblink3/rules.py ;;
8)
/usr/bin/hblink-update ;;
9)
echo "No updates" && sleep 2 ;;
10)
sudo apt-get update -y && sudo apt-get upgrade ;;
11)
sudo reboot now ;
esac
done
exit 0
# Menu system by ShaYmez https://github/ShaYmez

62
usr/local/sbin/restart Executable file
View File

@ -0,0 +1,62 @@
#!/bin/bash
# OBP-MASTER FORMERLY RYSEN MASTER+ (HBlink3) A FORK OF THE FREEDMR / HBLINK PROJECT
# This script written by Shane Daley M0VUB. The script gracefully shutsdown services while services are cleaned and logs are truncated.
# We can also add items in this script for future use like updates or further log trims.
# Add to the cron tab for auto execution
# Copyright (C) 2020 Shane P, Daley M0VUB <support@gb7nr.co.uk>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# Update containers / service clean/truncate/ and restart of services..
echo Restarting Server.....
cd /etc/hblink3
sleep 1
echo "."
sleep 1
echo ".."
sleep 1
echo "..."
docker-compose restart
sleep 1
figlet "OBP Master."
sleep 1
echo "Checking OBP is composed....."
sleep 1
docker ps
sleep 1
echo "Checking startup error logs....."
sleep 1
docker container logs hblink
echo "Done."
echo "Flushing network tracking table....."
conntrack -F
sleep 1
echo "Restarting HBmonitor....."
systemctl restart hbmon
figlet "HBmonitor3"
echo "Done."
echo "Now Exiting....."
sleep 1
echo .
sleep 1
echo ..
sleep 1
echo ...
echo "OBP MasterServer has been restarted. Proccess is now complete and you may now exit. AKA ShaYmez."

67
usr/local/sbin/start Executable file
View File

@ -0,0 +1,67 @@
#!/bin/bash
# OBP-MASTER FORMERLY RYSEN MASTER+ (HBlink3) A FORK OF THE FREEDMR / HBLINK PROJECT
# This script written by Shane Daley M0VUB. The script gracefully shutsdown services while services are cleaned and logs are truncated.
# We can also add items in this script for future use like updates or further log trims.
# Add to the cron tab for auto execution
# Copyright (C) 2020 Shane P, Daley M0VUB <support@gb7nr.co.uk>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# Start service(s) / and check logs.
clear
echo "Starting OBP MasterServer....."
cd /etc/hblink3
sleep 1
echo .
sleep 1
echo ..
sleep 1
echo ...
docker-compose up -d
sleep 1
figlet "OBP Master."
sleep 1
echo "Checking OBP is composed....."
sleep 1
docker ps
sleep 3
echo "Checking startup error logs....."
docker container logs hblink
echo "Done."
echo "Flushing network tracking table....."
conntrack -F
sleep 1
echo "Starting HBmonitor....."
systemctl restart hbmon
figlet "HBmonitor3"
echo "Done."
sleep 1
echo "Done. Now Exiting....."
sleep 1
echo .
sleep 1
echo ..
sleep 1
echo ...
echo "OBP MasterServer is now online. Flush is complete and you may now exit. AKA ShaYmez."
#
# This script has been developed by the one and only ShaYmez. Visit https://repo.radio/ShaYmez for more super scripts!
echo "All systems have been flushed/cleaned and ready to go. Aka Dr. Node. ShaYmez, OBP MasterServer"

50
usr/local/sbin/stop Executable file
View File

@ -0,0 +1,50 @@
#!/bin/bash
# OBP-MASTER FORMERLY RYSEN MASTER+ (HBlink3) A FORK OF THE FREEDMR / HBLINK PROJECT
# This script written by Shane Daley M0VUB. The script gracefully shutsdown services while services are cleaned and logs are truncated.
# We can also add items in this script for future use like updates or further log trims.
# Add to the cron tab for auto execution
# Copyright (C) 2020 Shane P, Daley M0VUB <support@gb7nr.co.uk>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# Start service(s) / and check logs.
clear
echo "Stopping OBP MasterServer....."
cd /etc/hblink3
sleep 2
echo .
sleep 1
echo ..
sleep 1
echo ...
docker-compose down
echo "Stopping HBmonitor....."
systemctl stop hbmon
figlet "HBmonitor3"
echo "Done."
sleep 1
echo "Done. Now Exiting....."
sleep 1
echo .
sleep 1
echo ..
sleep 1
echo ...
echo "OBP MasterServer is now stopped. AKA ShaYmez."
#
# This script has been developed by the one and only ShaYmez. Visit https://repo.radio/ShaYmez for more super scripts!
echo "All systems have been flushed/cleaned and ready to go. Aka Dr. Node. ShaYmez, OBP MasterServer"

71
usr/local/sbin/update Executable file
View File

@ -0,0 +1,71 @@
#!/bin/bash
# HBLINK3 DOCKER CONTROL SCRIPTS V1.9
# This script written by Shane Daley M0VUB. The script gracefully shuts down services while services are cleaned and logs are truncated.
# We can also add items in this script for future use like updates or further log trims.
# Add to the cron tab for auto execution
# Copyright (C) 2020 Shane P, Daley M0VUB <support@gb7nr.co.uk>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# Update containers / service clean/truncate/ and restart of services..
LOCAL_IP=$(ip a | grep inet | grep "ens18\|en" | awk '{print $2}' | tr '/' ' ' | awk '{print $1}')
ARC=$(lscpu | grep Arch | awk '{print $2}')
VERSION=$(sed 's/\..*//' /etc/debian_version)
clear
echo Starting update.....
sleep 1
echo "."
sleep 1
echo ".."
sleep 1
echo "..."
echo Stopping OBP MasterServer.....
cd /etc/hblink3
docker-compose down
echo Removing all docker images.....
docker rmi $(docker images -q -a) --force
figlet "ShaYmez."
sleep 1
echo Flushing services and restarting.....
/usr/bin/hblink-flush
echo "Done."
echo ""
echo ""
echo "*************************************************************************"
echo ""
echo " The OBP-MasterServer Update Is Complete! "
echo ""
echo " ******* To Upgrade run ./upgrade.sh ******* "
echo ""
echo " Use 'docker container logs hblink' to check the status. "
echo " logs are part in /var/log/hblink. "
echo " Just make sure this computer can be accessed over UDP specified port "
echo " You will need to edit your config and then run the following command "
echo ""
echo " cd /etc/hblink3 "
echo " docker-compose up -d "
echo " More documentation can be found on the HBlink3 git repo "
echo " https://github.com/ShaYmez/OBP-installer "
echo ""
echo " Your IP address is $LOCAL_IP "
echo ""
echo " Your running on $ARC with Debian $VERSION "
echo ""
echo " Thanks for using this script. "
echo " Copyright © 2022 Shane Daley - M0VUB "
echo " More information can be found @ https://freestar.network/development "
echo ""
echo "*************************************************************************"

23
usr/local/sbin/upgrade Executable file
View File

@ -0,0 +1,23 @@
#!/bin/bash
# HBLINK3 DOCKER CONTROL SCRIPTS V1.9
# This script written by Shane Daley M0VUB. The script gracefully shuts down services while services are cleaned and logs are truncated.
# We can also add items in this script for future use like updates or further log trims.
# Add to the cron tab for auto execution
# Copyright (C) 2020 Shane P, Daley M0VUB <support@gb7nr.co.uk>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# Upgrade script will be added later!
echo "Nothing to upgrade"
exit 0