updated structure

This commit is contained in:
ske087
2025-12-13 14:52:37 +02:00
parent 1a3e26d86d
commit e6193511e0
81 changed files with 0 additions and 10745 deletions

View File

@@ -0,0 +1,114 @@
#!/bin/bash
# Production Management Script for Trasabilitate Application
# Usage: ./manage_production.sh {start|stop|restart|status|logs|install-service}
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
print_success() {
echo -e "${GREEN}$1${NC}"
}
print_warning() {
echo -e "${YELLOW}⚠️ $1${NC}"
}
print_error() {
echo -e "${RED}$1${NC}"
}
print_info() {
echo -e "${BLUE} $1${NC}"
}
usage() {
echo "Usage: $0 {start|stop|restart|status|logs|install-service|help}"
echo ""
echo "Commands:"
echo " start Start the production server"
echo " stop Stop the production server"
echo " restart Restart the production server"
echo " status Show server status"
echo " logs Show recent logs"
echo " install-service Install systemd service"
echo " help Show this help message"
echo ""
}
case "$1" in
start)
./start_production.sh
;;
stop)
./stop_production.sh
;;
restart)
echo -e "${BLUE}🔄 Restarting Trasabilitate Application${NC}"
echo "=============================================="
./stop_production.sh
sleep 2
./start_production.sh
;;
status)
./status_production.sh
;;
logs)
echo -e "${BLUE}📋 Recent Error Logs${NC}"
echo "=============================================="
if [[ -f "/srv/quality_recticel/logs/error.log" ]]; then
tail -20 /srv/quality_recticel/logs/error.log
else
print_error "Error log file not found"
fi
echo ""
echo -e "${BLUE}📋 Recent Access Logs${NC}"
echo "=============================================="
if [[ -f "/srv/quality_recticel/logs/access.log" ]]; then
tail -10 /srv/quality_recticel/logs/access.log
else
print_error "Access log file not found"
fi
;;
install-service)
echo -e "${BLUE}📦 Installing Systemd Service${NC}"
echo "=============================================="
if [[ ! -f "trasabilitate.service" ]]; then
print_error "Service file not found"
exit 1
fi
print_info "Installing service file..."
sudo cp trasabilitate.service /etc/systemd/system/
print_info "Reloading systemd daemon..."
sudo systemctl daemon-reload
print_info "Enabling service..."
sudo systemctl enable trasabilitate.service
print_success "Service installed successfully!"
echo ""
echo "Systemd commands:"
echo " sudo systemctl start trasabilitate # Start service"
echo " sudo systemctl stop trasabilitate # Stop service"
echo " sudo systemctl restart trasabilitate # Restart service"
echo " sudo systemctl status trasabilitate # Check status"
echo " sudo systemctl enable trasabilitate # Enable auto-start"
echo " sudo systemctl disable trasabilitate # Disable auto-start"
;;
help|--help|-h)
usage
;;
*)
print_error "Invalid command: $1"
echo ""
usage
exit 1
;;
esac