@@ -141,9 +141,10 @@ sleep 2
141141# Start server in background (output goes to /tmp/moqui-server.log)
142142nohup ./gradlew run > /tmp/moqui-server.log 2>&1 &
143143
144- # Wait for server to be ready (typically 30-60 seconds)
144+ # Wait for server to be ready (typically 2-5 seconds after previous startup )
145145for i in {1..60}; do
146- if grep -q " Started oejs.ServerConnector.*8080" /tmp/moqui-server.log 2> /dev/null; then
146+ if grep -q " Started oejs.ServerConnector.*8080" /tmp/moqui-server.log 2> /dev/null || \
147+ strings /tmp/moqui-server.log 2> /dev/null | grep -q " Started oejs.ServerConnector.*8080" ; then
147148 echo " Server is ready!"
148149 break
149150 fi
@@ -152,23 +153,22 @@ done
152153```
153154
154155** Verifying Server is Running** :
155-
156156``` bash
157157# Test with a simple REST call
158158curl -u john.doe:moqui http://localhost:8080/rest/s1/mantle/parties
159-
160- # Or check the log for the startup message
161- grep " Started oejs.ServerConnector.*8080" /tmp/moqui-server.log
159+ # Or check the log for the startup message (use strings if log is binary)
160+ grep " Started oejs.ServerConnector.*8080" /tmp/moqui-server.log || strings /tmp/moqui-server.log | grep " Started oejs.ServerConnector.*8080"
162161```
163162
164163** Stopping the Server** :
165-
166164``` bash
167- # Find and kill the Gradle process
165+ # IMPORTANT: Stop any existing server first to avoid port conflicts
168166pkill -f " gradlew run"
169-
170- # Or find the specific PID
171- ps aux | grep " gradlew run" | grep -v grep | awk ' {print $2}' | xargs kill
167+ # Also kill any java process using port 8080 (in case Gradle spawned it)
168+ kill $( ss -tlnp 2> /dev/null | grep :8080 | grep -oP ' pid=\K\d+' | head -1) 2> /dev/null || true
169+ sleep 2
170+ # Verify port is free
171+ ss -tlnp 2> /dev/null | grep :8080 || echo " Port 8080 is free"
172172```
173173
174174** Notes:**
0 commit comments