bridgehead/stop.sh

40 lines
966 B
Bash
Executable File

#!/usr/bin/env bash
# Shut down a running Bridgehead and disable auto restart.
# Behind the scenes we use systemctl to do the work.
# Function to print usage
print_usage() {
echo "Stop the running Bridgehead, disable auto-restart"
echo "Usage: $0 [--help | -h]"
echo "Options:"
echo " --help, -h Display this help message."
echo " No options Stop Bridgehead only."
}
# Parse arguments
while [[ "$#" -gt 0 ]]; do
case $1 in
--help|-h)
print_usage
exit 0
;;
*)
echo "Error: Unknown argument '$1'"
print_usage
exit 1
;;
esac
shift
done
# Set up systemctl for EHDS2/ECDC if necessary
cp /srv/docker/bridgehead/ecdc.service /etc/systemd/system
systemctl daemon-reload
systemctl enable ecdc.service
# Use systemctl to stop the Bridgehead if it is running
sudo systemctl disable ecdc.service
sudo systemctl stop ecdc.service