-2

I am running linux based server (centos 6.0) with cpanle and WHM,

I have critical website running with a chat server which uses a openfire as the chat server backend server, I have monitored last few weeks this service crashes quite often, I have no way of knowing that, and I have to wait till the next day to restart the server. (and this can only be fixed by using server reboot as its got to do with some Java memory problem)

Is there a way I can setup a monitoring service to the server and if this service goes down server itself will reboot ?

Is this something possible or is there a better way to overcome this problem ?

1
  • A better way? Sure, don't use Java, use something that doesn't suck instead. Nov 27, 2012 at 0:05

3 Answers 3

1

A better way would be to configure openfire/java properly so it doesn't run you out of memory.

1
1

Look at Monit for process/system monitoring.

Just an example config. I don't know anything about Openfire...

check process openfire
        with pidfile "/var/run/openfire/openfire.pid"
        start program = "/sbin/service openfire start"
        stop program = "/sbin/service openfire stop"
        if 10 restarts within 11 cycles then timeout
        if cpu usage > 95% for 11 cycles then restart
        if totalmemory > 512 MB then restart # This can be any number...

This would restart the service if a particular paramater was exceeded; memory in this case.

0

Its might be good to run crontab daily checking of your program if its running or not ? , and do restart the service if its failed. The easiest way to check process running is using ps aux | grep proc-name or using pgrep. Just create a process running checker script which run on some period by cron.

1
  • 1
    If your program is not a daemon (service) you can run it under control of another process to restart the program if the failure caused your program to stop. Nov 25, 2012 at 10:33

Not the answer you're looking for? Browse other questions tagged .