I have a program that using phantomjs
.
There should be only a instance for the program and there is no program using Phantomjs
.
But sometimes Phantomjs
are launched several instances sametime. Probably my program have a bug. For quick fix I want to kill old instance if there are Phantomjs
instance more than one by monit.
I can find the instances of Phantomjs by using matching
function in monit
. But I couldn't find out how to compare two instance status and kill old one.
I'd be very grateful for any advice.
Use a timestamp on each instance then use:
.quit()
On the oldest instance?
This method kills the instance and all resources.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With