monitor chrome with god

42 views
Skip to first unread message

Sheng LUO

unread,
Apr 2, 2012, 9:20:40 AM4/2/12
to god...@googlegroups.com
hi there,

My ubuntu runs on 1G ram, where chrome always get fronzen or crashed because of flash.
So I want to watch my chrome with god and limit the cpu and memory it occupies.
Normally, I can run a chrome by typing "google-chrome" in terminal, so I write following god script:

God.watch do |w|
  w.name = "chrome"
  w.start = "/opt/google/chrome/chrome"
  w.keepalive :cpu_max => 80.percent, :memory_max => 500.megabytes
end

When I start the script above by "god -c chrome.god -D", it just keep opening new chrome.
Doesn't it automatically figure out there is already a chrome running?
What can I do to realize monitoring chrome?

Nuno Valente

unread,
Apr 6, 2012, 3:25:41 PM4/6/12
to god...@googlegroups.com
Try adding :

      w.stop = "kill -9 {{PID}}"
 
      w.behavior(:clean_pid_file)
      
      w.start_if do |start|
        start.condition(:process_running) do |c|
          c.interval = 30.seconds
          c.running = false
        end
      end

Best regards,
Nuno Valente.


--
You received this message because you are subscribed to the Google Groups "god.rb" group.
To view this discussion on the web visit https://groups.google.com/d/msg/god-rb/-/QzSqOZcU6ZEJ.
To post to this group, send email to god...@googlegroups.com.
To unsubscribe from this group, send email to god-rb+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/god-rb?hl=en.

Reply all
Reply to author
Forward
0 new messages