Archives for: April 2012, 30

30/04/12

Permalink 03:10:48 pm, by Greg, 188 words, 344 views   English (CA)
Categories: Announcements; Mins. worked: 0

Tomcat launcher

I wrote a quick bash script that lets me start or stop a local instance of tomcat with a single click. If you ONLY intend to ever run one tomcat at a time this will work pretty well.

It uses catalina.sh instead of startup.sh, and sets the CATALINA_PID variable to write a file containing the pid of the launched tomcat.

It first checks to see if there is a pid file at the location set by CATALINA_PID. If there is, the script reads the file and, making the assumption that you want to stop the running tomcat, calls 'catalina.sh stop', waits a few seconds and checks for the pid file again. If the file still exists it runs kill -9 on the pid, hopefully *really* stopping tomcat.

If there is no pid file we assume that tomcat is not running, and run the launch command. In my case I set the java version first, then provide a path for the PID variable, then run 'catalina.sh start'

More details in the code comments.

UPDATED FOR MAC OS: added OS X-specific alerts.

Script attached

Maintenance

This blog is the location for all work involving software and hardware maintenance, updates, installs, etc., both routine and urgent, in the server room, the labs and the R&D rooms.

Reports

Categories

April 2012
Sun Mon Tue Wed Thu Fri Sat
 << < Current> >>
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30          

XML Feeds