chore: auto-commit 2026-03-30 06:40

This commit is contained in:
administrator 2026-03-30 06:40:37 +01:00
parent 19866a97a9
commit cdff390ae0

View file

@ -21,10 +21,25 @@ CYAN='\033[0;36m'
BOLD='\033[1m'
NC='\033[0m'
# Defaults
# ==============================================================================
# CHECK FOR SUDO / ROOT PRIVILEGES
# ==============================================================================
if [ "$EUID" -ne 0 ]; then
echo -e "${RED}${BOLD}ERROR:${NC} This script must be run with sudo or as root."
echo -e "${YELLOW}Please run: sudo $0${NC}"
exit 1
fi
# ==============================================================================
# CONFIGURATION
# ==============================================================================
INSTANCE_DIR="/opt"
INSTANCE_NAME=""
# ==============================================================================
# FUNCTIONS
# ==============================================================================
# Function to find the Wallarm instance directory
find_wallarm_instance() {
local dirs=()
@ -200,8 +215,8 @@ update_config() {
fi
# Replace the original config with the new one
sudo mv "$temp_config" "$config_file"
sudo chmod 644 "$config_file"
mv "$temp_config" "$config_file"
chmod 644 "$config_file"
echo -e "${GREEN}Configuration updated.${NC}"
}
@ -209,15 +224,15 @@ update_config() {
restart_container() {
local container_name="$1"
echo -e "${YELLOW}Restarting container $container_name to apply changes...${NC}"
if sudo docker ps --format "{{.Names}}" | grep -q "^$container_name$"; then
sudo docker restart "$container_name"
if docker ps --format "{{.Names}}" | grep -q "^$container_name$"; then
docker restart "$container_name"
echo -e "${GREEN}Container restarted.${NC}"
else
echo -e "${RED}Container $container_name is not running. Starting it...${NC}"
if [ -f "$INSTANCE_DIR/start.sh" ]; then
sudo "$INSTANCE_DIR/start.sh"
"$INSTANCE_DIR/start.sh"
else
echo -e "${RED}No start script found. Please start manually: sudo docker start $container_name${NC}"
echo -e "${RED}No start script found. Please start manually: docker start $container_name${NC}"
exit 1
fi
fi
@ -247,7 +262,7 @@ main() {
restart_container "$INSTANCE_NAME"
else
echo -e "${YELLOW}Changes will take effect after container restart.${NC}"
echo -e "You can restart later with: sudo docker restart $INSTANCE_NAME"
echo -e "You can restart later with: docker restart $INSTANCE_NAME"
fi
echo -e "\n${GREEN}${BOLD}Reconfiguration completed.${NC}"