How do you stop a perl Dancer/Starman/Plack server?
Asked Answered
A

3

12

I started a Dancer/Starman server using:

sudo plackup -s Starman -p 5001 -E deployment --workers=10 -a mywebapp/bin/app.pl

but I'm unsure how I can stop the server. Can someone provide me with a quick way of stopping it and all the workers it has spawned?

Andersen answered 17/6, 2013 at 21:30 Comment(2)
Why sudo? Do you really need to run this thing as root?Kenrick
Good question... probably not! :)Andersen
O
16

Use the

--pid /path/to/the/pid.file

and you can kill the process based on his PID

So, using the above options, you can use

kill $(cat /path/to/the/pid.file)

the pid.file simply stores the master's PID - don't need analyze the ps output...

Outcrop answered 17/6, 2013 at 21:36 Comment(6)
I killed the process, but now I can't restart it using plackup. It says there's still a server running on that portAndersen
don't use kill -9, but simple kill. Now manually remove the pid-file. The kill -9 doesn't closes opened sockets and so on...Outcrop
Oops :( So I already used kill -9. Anyway to recover? Also, where do I find the pid-file? None was specified at startup. And the process seems to be continuing to serve requests on port 5001, even tho I killed it with kill -9!Andersen
if pid file is not specified, here in no one. The recover depends on your system (i hope) - maybe after some timeout the sockets closes - but im not sure. Bad habit using kill -9 for all things... :)Outcrop
Thanks jm666 - good to know. Maybe I'll try a reboot and see if the pesky Starman job will die. It's weird tho that I can't even see it with a ps. Hardy little process!Andersen
use lsof -i:5001 (or maybe sudo lsof -i:5001) to find which processes are serving that portShipboard
L
1

pkill -f starman

Kill processes based on name.

Lorgnon answered 16/10, 2014 at 7:4 Comment(0)
H
0

On Windows you can do "CTRL + C" like making a copy but Cancel in this case. Tested working.

Hutto answered 22/6, 2017 at 19:12 Comment(1)
The OP's usage of sudo implies that he's on Linux (or Unix in general). CTRL+C works there as well if the server runs in foreground. But I think the question was about stopping the server with a command.Fishmonger

© 2022 - 2024 — McMap. All rights reserved.