mirror of
https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
synced 2026-02-01 13:22:04 -08:00
finding process by port
This commit is contained in:
parent
54dffa8595
commit
4ccdce83f9
1 changed files with 8 additions and 12 deletions
20
.github/workflows/on_merge_to_master.yaml
vendored
20
.github/workflows/on_merge_to_master.yaml
vendored
|
|
@ -25,11 +25,13 @@ jobs:
|
|||
cd /home/ec2-user/apps
|
||||
|
||||
# Terminate any running instances of the Python app
|
||||
if pgrep -f "python launch.py" > /dev/null; then
|
||||
echo "Terminating existing instance of the app..."
|
||||
pkill -f "python launch.py"
|
||||
PORT=7860
|
||||
PID=$(lsof -t -i:$PORT)
|
||||
if [ ! -z "$PID" ]; then
|
||||
echo "Terminating process running on port $PORT with PID $PID..."
|
||||
kill -9 $PID
|
||||
else
|
||||
echo "No existing instance found."
|
||||
echo "No process is running on port $PORT."
|
||||
fi
|
||||
|
||||
# Check if the stable-diffusion-webui folder exists
|
||||
|
|
@ -71,15 +73,9 @@ jobs:
|
|||
# Return to the main project directory
|
||||
cd ..
|
||||
|
||||
# Start the application with nohup and delay
|
||||
nohup python launch.py --nowebui --listen --api &
|
||||
# Run the application in the background using nohup
|
||||
nohup python launch.py --nowebui --listen --api > nohup.out 2>&1 &
|
||||
|
||||
# Wait for 60 seconds to allow the application to fully start
|
||||
sleep 60
|
||||
|
||||
# Redirect nohup output
|
||||
> nohup.out 2>&1
|
||||
|
||||
# Detach from the SSH session to prevent hanging
|
||||
exit
|
||||
EOF
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue