How to kill old instance of phantomjs by monit
Asked Answered
Y

1

7

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.

Yarber answered 5/7, 2015 at 5:17 Comment(0)
R
1

Use a timestamp on each instance then use:

.quit()

On the oldest instance?

This method kills the instance and all resources.

Ricercare answered 16/7, 2015 at 10:32 Comment(1)
Thanks for answer, but I want to know how to compare the time stamps of multiple instance in monit, not the way how to kill the instance. Or am I misunderstanding your answer?Yarber

© 2022 - 2024 — McMap. All rights reserved.