Files
ptero-nginx-egg/start.sh
T
finnie2006 aed2f66bce Update start.sh
Improved coloring and using if else for php and tmp files cleaning
2024-12-28 20:35:54 +01:00

48 lines
1.1 KiB
Bash

#!/bin/ash
# Colors for output
GREEN="\033[0;32m"
YELLOW="\033[1;33m"
RED="\033[0;31m"
RESET="\033[0m"
# Function to print messages with colors
log_success() {
echo -e "${GREEN}[SUCCESS] $1${RESET}"
}
log_warning() {
echo -e "${YELLOW}[WARNING] $1${RESET}"
}
log_error() {
echo -e "${RED}[ERROR] $1${RESET}"
}
# Clean up temp directory
echo "⏳ Cleaning up temporary files..."
if rm -rf /home/container/tmp/*; then
log_success "Temporary files removed successfully."
else
log_error "Failed to remove temporary files."
exit 1
fi
# Start PHP-FPM
echo "⏳ Starting PHP-FPM..."
if /usr/sbin/php-fpm8 --fpm-config /home/container/php-fpm/php-fpm.conf --daemonize; then
log_success "PHP-FPM started successfully."
else
log_error "Failed to start PHP-FPM."
exit 1
fi
# NGINX if else WIP
echo "⏳ Starting Nginx..."
# Final message
log_success "Web server is running. All services started successfully."
/usr/sbin/nginx -c /home/container/nginx/nginx.conf -p /home/container/
# Keep the container running (optional, depending on your container setup)
tail -f /dev/null