72 lines
2.9 KiB
Bash
Executable File

#!/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 "*************************************************************************"