Spaces:
Sleeping
Sleeping
Upload startup.sh
Browse files- startup.sh +2 -14
startup.sh
CHANGED
|
@@ -1,23 +1,11 @@
|
|
| 1 |
#!/bin/sh
|
| 2 |
|
| 3 |
-
# Create log directory if it doesn't exist
|
| 4 |
-
mkdir -p /var/log
|
| 5 |
-
|
| 6 |
# Start the Node.js server in the background
|
| 7 |
-
node index.js
|
| 8 |
NODE_PID=$!
|
| 9 |
|
| 10 |
# Give the server a moment to start
|
| 11 |
-
sleep
|
| 12 |
-
|
| 13 |
-
# Check if the server is running
|
| 14 |
-
if ! kill -0 $NODE_PID 2>/dev/null; then
|
| 15 |
-
echo "Node.js server failed to start. Check logs in /var/log/node-server.log"
|
| 16 |
-
exit 1
|
| 17 |
-
fi
|
| 18 |
-
|
| 19 |
-
echo "Node.js server started with PID $NODE_PID"
|
| 20 |
|
| 21 |
# Start nginx in the foreground
|
| 22 |
-
echo "Starting nginx..."
|
| 23 |
nginx -g "daemon off;"
|
|
|
|
| 1 |
#!/bin/sh
|
| 2 |
|
|
|
|
|
|
|
|
|
|
| 3 |
# Start the Node.js server in the background
|
| 4 |
+
node index.js &
|
| 5 |
NODE_PID=$!
|
| 6 |
|
| 7 |
# Give the server a moment to start
|
| 8 |
+
sleep 3
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
|
| 10 |
# Start nginx in the foreground
|
|
|
|
| 11 |
nginx -g "daemon off;"
|