Friday, December 10, 2010

APEX Listener startup/shutdown script

David asked me for a way to keep the listener up and running when a box is rebooted. There may very well be better ways to do this but this script can be used to start, stop, get status, and tail the log file. Also it can be dropped in as an init.d script to have the Listener start when the box starts. Since we don't have access to init.d for David's case, we are just going to put in a cron job to check status and start if not already going. The start function checks to ensure it's not already running before trying to start it up. You should be able to use this but just changing the location variables in the top of the file.

The one addition over a normal init.d is the log command I added ( which is very simple). Just do ./listener.sh log and it will tail the log file.