mirror of
https://github.com/samply/bridgehead.git
synced 2025-06-17 03:40:14 +02:00
Monitoring for bridgehead startup and update (#22)
This commit is contained in:
@ -1,9 +1,11 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
source lib/log.sh
|
||||
|
||||
exitIfNotRoot() {
|
||||
if [ "$EUID" -ne 0 ]; then
|
||||
log "ERROR" "Please run as root"
|
||||
exit 1
|
||||
fail_and_report 1 "Please run as root"
|
||||
fi
|
||||
}
|
||||
|
||||
@ -16,10 +18,6 @@ checkOwner(){
|
||||
return 0
|
||||
}
|
||||
|
||||
log() {
|
||||
echo -e "$(date +'%Y-%m-%d %T')" "$1:" "$2"
|
||||
}
|
||||
|
||||
printUsage() {
|
||||
echo "Usage: bridgehead start|stop|update|install|uninstall PROJECTNAME"
|
||||
echo "PROJECTNAME should be one of ccp|nngm|gbn"
|
||||
@ -28,7 +26,7 @@ printUsage() {
|
||||
checkRequirements() {
|
||||
if ! lib/prerequisites.sh; then
|
||||
log "ERROR" "Validating Prerequisites failed, please fix the error(s) above this line."
|
||||
exit 1
|
||||
fail_and_report 1 "Validating prerequisites failed."
|
||||
else
|
||||
return 0
|
||||
fi
|
||||
@ -97,6 +95,19 @@ assertVarsNotEmpty() {
|
||||
return 0
|
||||
}
|
||||
|
||||
fixPermissions() {
|
||||
CHOWN=$(which chown)
|
||||
sudo $CHOWN -R bridgehead /etc/bridgehead /srv/docker/bridgehead
|
||||
}
|
||||
|
||||
source lib/monitoring.sh
|
||||
|
||||
fail_and_report() {
|
||||
log ERROR "$2"
|
||||
hc_send $1 "$2"
|
||||
exit $1
|
||||
}
|
||||
|
||||
##Setting Network properties
|
||||
export HOSTIP=$(MSYS_NO_PATHCONV=1 docker run --rm --add-host=host.docker.internal:host-gateway ubuntu cat /etc/hosts | grep 'host.docker.internal' | awk '{print $1}');
|
||||
export HOST=$(hostname)
|
||||
|
Reference in New Issue
Block a user