I just tried to automate the laravel process like(Start, Stop) in shell scripts. To start the laravel server, I use php artisan serve in the shell file.
I tried to stop the laravel server using command. But I was wonder, I didnt see any commands to stop the server. I used to Ctl+C to stop the server or to close the command prompt.
1.Any laravel commands to stop the server ?
How can I stop them now ? I dont have any command prompts running this process to exit the server.
You can kill the port
sudo kill $(sudo lsof -t -i:port_number)
Like if it is running on 8000, you can do below
sudo kill $(sudo lsof -t -i:8000)
If above not worked (because frozen or unresponsive process may not respond), add parameter -9
to kill command like this:
sudo kill -9 $(sudo lsof -t -i:8000)