Stopping K2 Server

You can run K2 Server either as a Windows service or in a command window, as an ordinary application. Unless you use the -ntService 1 option when starting K2 Server, K2 runs in the command window.

Stopping K2 when run as a service

To halt K2 Server when it is running as a Windows service, you have two options:

Stopping K2 when run as an application

When K2 is running as an application in a command window, you stop K2 by issuing a Ctrl+C keyboard command to kill the process in the window where it is running.

Stopping K2 Server on Linux/UNIX

The ColdFusion installation includes a script for halting K2 Server. The stopk2server script can be found in /opt/coldfusion/bin by default.

UNIX/Linux stopk2server script file listing

#!/bin/sh
#
# stop k2 server - setup environment and stop k2 server
#
#
# Get the pid for the process specified
#
pidproc()
{
  pid=`ps -eo'pid,comm' |
    grep $1 |
    sed -e 's/^  *//' -e 's/ .*//'`
}
#
# Kill named process(es).
# Try killing it nicely at first.  If it won't die willing, 
# then use kill -9
#
killproc()
{
  pidproc $1

   if [ "$pid" != "" ] ; then
     kill $pid
     pidproc $1

     if [ "$pid" != "" ] ; then
      sleep 5                       # give it sometime to die
      pidproc $1

      if [ "$pid" != "" ] ; then    # if it still lives, use -9
        kill -9 $pid
      fi

    fi

  fi
}

# Make sure K2 server goes away
  killproc k2server

exit 0