-
Notifications
You must be signed in to change notification settings - Fork 105
/
Copy pathstart.sh
47 lines (39 loc) · 1.08 KB
/
start.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/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