my whm and tomcat story

Managing WHM based server is easy for everyone. I thought no Linux knowledge needed. Managing name server, mail, redirect etc are already web base. Updating web server is easy. Apache, MySQL/postgresql, PHP and the modules are available with latest version, just choose what does we want, and during that configuration we guided by easyApache. If using the shell we can run this command /scripts/easyapache

Once, I need to check my ajexa server wether it's still on or already down. If the server down I need to restart it. And I found all server related services commands are on /scripts directory including command that I need 'restartsrv_tomcat'.
So then I create this python script which called ajexaSrvHandler.py on /etc/cron.daily which contain these code:

#!/usr/bin/python
import httplib
import subprocess

conn = httplib.HTTPConnection('www.mywebsite.com', 8080)
conn.request('GET', '/ajexasrv/')

response = conn.getresponse()
if response.status != 200:
  subprocess.call('/scripts/restartsrv_tomcat')
  print "ajexasrv had failed and just already restarted"
conn.close()

And that script sent me email that contain printed value after restart the tomcat server, since I already put my email address on 'System mail Preference'. Very helpful thought, with minimum effort.

0 Responses: