start deploy
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
log() {
|
||||
local message="$1"
|
||||
echo -e "\033[32mLog: $message\033[0m"
|
||||
}
|
||||
|
||||
handle_error() {
|
||||
local error_message="$1"
|
||||
echo -e "\033[31mError: $error_message\033[0m"
|
||||
exit 1
|
||||
}
|
||||
|
||||
retry() {
|
||||
local max_attempts=2
|
||||
local attempt=1
|
||||
local delay=1
|
||||
|
||||
while true; do
|
||||
"$@" && break || {
|
||||
if [ $attempt -lt $max_attempts ]; then
|
||||
log "Command failed (attempt $attempt/$max_attempts). Retrying in $delay seconds..."
|
||||
sleep $delay
|
||||
delay=$((delay * 2))
|
||||
((attempt++))
|
||||
else
|
||||
handle_error "Command failed after $attempt attempts: $*"
|
||||
fi
|
||||
}
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
################################################################################
|
||||
# MAIN
|
||||
################################################################################
|
||||
if [ "$1" == "product" ]; then
|
||||
#start_services
|
||||
docker login -u="admin" -p="may12002" registry.simbrellang.net
|
||||
|
||||
elif [ "$1" == "clean" ]; then
|
||||
retry docker stop digi_co
|
||||
else
|
||||
handle_error "Invalid argument. Use 'clean' or 'product'."
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user