Skip to content

Commit

Permalink
Update startup script to remove stale PHP-FPM pid files.
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickcarlohickman committed Feb 2, 2024
1 parent 28d6ef3 commit 7bcec18
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions setup/resources/wsl/startup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,20 @@ if [[ $(id -u) -ne 0 ]]; then
exit 1
fi

# If PHP-FPM wasn't stopped properly, its .pid file will still exist. When
# restarting the service, it will get stuck if a stale .pid file exists.
# Remove the stale existing .pid files so the restart won't get stuck.
for file in `find /opt/phpenv/versions -name "*.pid"`
do
PHPFPM_PID=$(cat $file)
PID_CMD=$(ps -p $PHPFPM_PID -o comm=)

if [[ "$PID_CMD" != "php-fpm" ]]; then
echo "Removing stale pid file [$file]."
rm -f $file
fi
done

service redis-server restart
service mysql restart
service apache2 restart

0 comments on commit 7bcec18

Please sign in to comment.