diff --git a/.github/workflows/on_merge_to_master.yaml b/.github/workflows/on_merge_to_master.yaml index a1e5632c9..1a83a803f 100644 --- a/.github/workflows/on_merge_to_master.yaml +++ b/.github/workflows/on_merge_to_master.yaml @@ -24,6 +24,16 @@ jobs: ssh -o ServerAliveInterval=60 -o ServerAliveCountMax=60 -o StrictHostKeyChecking=no ${{ secrets.MOONLITE_AWS_EC2_SSH_USER }}@${{ secrets.MOONLITE_AWS_EC2_SSH_HOST }} << 'EOF' cd /home/ec2-user/apps + # Kill any existing process of launch.py if running + echo "Checking for existing launch.py process..." + PID=\$(pgrep -f launch.py) + if [ -n "\$PID" ]; then + echo "Found running process for launch.py. Terminating PID \$PID..." + kill -9 \$PID + else + echo "No running process found for launch.py." + fi + # Check if the stable-diffusion-webui folder exists if [ ! -d "stable-diffusion-webui" ]; then echo "Cloning stable-diffusion-webui from GitHub..."