#!/usr/bin/sh # servletstop # # by Jeff Schmitt # Towson University # # version 0.3 October 4, 1998 # # This script will do the following: # 1) Determine if a process is listening to your port $PORT. # If so, then it is assumed that it is your servletrunner # 2) If necessary, kill the process, stopping your server # # Since the servletrunner server cannot determine when a change has # been made to a .class file of a servlet, you must stop the server # after making a change to a class file in your servlet directory. # The servletrun script will automatically restart your server for you # the next time you access your servlet # Define the port where your server will listen # Port numbers should be between 10000 and 65535 # Use the same port for all of your servlets # Each user should have a unique port number PORT=65535 # Below this line should not normally require editing ########################################################## # we need to know if the server is already running. # Get the process id of the process listening on tcp $PORT # this process id will be null if no process FUSER=`fuser $PORT/tcp 2>/dev/null` # check for non-null processid STATUS="was not running" if [ -n "$FUSER" ] then # kill the servletrunner server # kill $FUSER STATUS="process $FUSER has been killed" fi cat < Server Stopped

Server Stopped

The server on port $PORT $STATUS. EOF