Feature: move portcheck into python application (#187)
* moved port check from shell script into the python application * fixed pulseaudio check console output * portcheck has now 15 chances to get the port before abort
This commit is contained in:
1 parent
b800f93f50
commit
f2e3d8e7d3
2 files changed
+27
-28
No files matched your search
+2
-23
@@ -86,7 +86,7 @@ fi
|
||||
CP_MAX_RETRIES=30
|
||||
CP_RETRY_DELAY=1
|
||||
### while maybe besser?
|
||||
echo "Checking port $PORT..."
|
||||
echo "Checking PulseAudio service status..."
|
||||
for i in $(seq 1 $CP_MAX_RETRIES); do
|
||||
# Check if PulseAudio is running
|
||||
if pactl info >/dev/null 2>&1; then
|
||||
@@ -102,28 +102,7 @@ for i in $(seq 1 $CP_MAX_RETRIES); do
|
||||
echo "⏳ PulseAudio not running yet, retrying in $CP_RETRY_DELAY s..."
|
||||
sleep $CP_RETRY_DELAY
|
||||
done
|
||||
|
||||
|
||||
### Check port availability
|
||||
# PORT variable is used from env
|
||||
PA_MAX_RETRIES=30
|
||||
PA_RETRY_DELAY=2
|
||||
echo "Checking port $PORT..."
|
||||
for i in $(seq 1 $PA_MAX_RETRIES); do
|
||||
# Wait for port to be free (in case of rapid restarts)
|
||||
if ! ss -tln | grep -q ":${PORT} "; then
|
||||
echo "Port $PORT is available"
|
||||
break
|
||||
fi
|
||||
|
||||
if [ $i -eq $PA_MAX_RETRIES ]; then
|
||||
echo "ERROR: Port $PORT still in use after $((PA_MAX_RETRIES * PA_RETRY_DELAY)) seconds"
|
||||
exit 2
|
||||
fi
|
||||
|
||||
echo "Attempt $i/$PA_MAX_RETRIES: Port $PORT in use, waiting ${PA_RETRY_DELAY}s..."
|
||||
sleep $PA_RETRY_DELAY
|
||||
done
|
||||
echo "✅ PulseAudio is running"
|
||||
|
||||
|
||||
### Start application
|
||||
|
||||
Reference in new issue
Block a user