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.
To halt K2 Server when it is running as a Windows service, you have two options:
k2server -ntService 0
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.
The ColdFusion installation includes a script for halting K2 Server. The stopk2server script can be found in /opt/coldfusion/bin by default.
#!/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