-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart.sh
More file actions
executable file
·37 lines (27 loc) · 873 Bytes
/
Copy pathstart.sh
File metadata and controls
executable file
·37 lines (27 loc) · 873 Bytes
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
#!/bin/bash
# Start the queue worker in the background
php artisan queue:work --tries=1 --timeout=300 > storage/logs/queue.log 2>&1 &
# Store the queue worker process ID
QUEUE_WORKER_PID=$!
# Function to clean up processes on script exit
cleanup() {
echo "Stopping processes..."
# Kill the queue worker
kill $QUEUE_WORKER_PID 2>/dev/null
# Kill any remaining PHP processes
pkill -f "php artisan serve" 2>/dev/null
exit 0
}
# Trap script termination
trap cleanup INT TERM
# Start the Laravel development server
echo "Starting Laravel development server..."
php artisan serve --host=0.0.0.0 &
# Store the server process ID
SERVER_PID=$!
echo "Development server and queue worker started."
echo "Press Ctrl+C to stop both processes."
# Wait for the server process to complete
wait $SERVER_PID
# If we get here, the server was stopped
cleanup