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?

Vijay Boyapati
  • 7,632
  • 7
  • 31
  • 48

3 Answers3

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...

clt60
  • 62,119
  • 17
  • 107
  • 194
  • I killed the process, but now I can't restart it using plackup. It says there's still a server running on that port – Vijay Boyapati Jun 17 '13 at 21:42
  • 1
    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... – clt60 Jun 17 '13 at 21:44
  • 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! – Vijay Boyapati Jun 17 '13 at 21:45
  • 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... :) – clt60 Jun 17 '13 at 21:48
  • 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! – Vijay Boyapati Jun 17 '13 at 21:55
  • 2
    use `lsof -i:5001` (or maybe `sudo lsof -i:5001`) to find which processes are serving that port – mob Jun 17 '13 at 22:10
1

pkill -f starman

Kill processes based on name.

Shibu
  • 141
  • 1
  • 6
0

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

Dung
  • 19,199
  • 9
  • 59
  • 54
  • 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_. – PerlDuck Jun 23 '17 at 10:58