Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 ?

share|improve this question

closed as off topic by Ward, EEAA, Magellan, Scott Pack, growse Nov 27 '12 at 17:05

Questions on Server Fault are expected to relate to server, networking, or related infrastructure administration within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

A better way? Sure, don't use Java, use something that doesn't suck instead. – HopelessN00b Nov 27 '12 at 0:05

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

share|improve this answer
i tried so many times, but still not a realistic solutions…… – user1179459 Nov 25 '12 at 9:26

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

share|improve this answer

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.

share|improve this answer
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. – Amir Naghizadeh Nov 25 '12 at 10:33

Not the answer you're looking for? Browse other questions tagged or ask your own question.