http://issues.hudson-ci.org/browse/HUDSON-2729
http://hudson.gotdns.com/wiki/display/HUDSON/Spawning+processes+from+build
We use the following shell script to stop and start Tomcat servers. The key part of the script is the setting of the environmental variable BUILD_ID=dontKillMe which overrides the default environmental variable setting Hudson gave the variable and thus prevents it from killing the background processes.
#!/bin/bash
#.Name
# startTomcat.sh
#.What
# Starts a tomcat container. This script handles some nuances of Hudson
# in which it kills background processes that you want to have stay alive
# after a build job (e.g. Restart Tomcat) finishes.
#
#.See
# http://issues.hudson-ci.org/browse/HUDSON-2729
# http://hudson.gotdns.com/wiki/display/HUDSON/Spawning+processes+from+build
exec 2>&1;
BUILD_ID=dontKillMe; export BUILD_ID;
if [ $# -ne 1 ]
then
echo "Usage: $0 full_path_to_tomcat_directory"
exit 1
fi
if [ ! -d ${1} ]
then
echo "Not a directory: ${1}"
exit 2
fi
echo $0 starting $(date)
set -x
pwd
cd $1
if [ $? -ne 0 ]
then
echo "Directory not found or has wrong permissions: $1"
exit 3
fi
pwd
./tomcat.sh stop
sleep 5
./tomcat.sh start >> ${1}/logs/start.log 2>&1
echo $0 completed $(date)
exit 0
No comments:
Post a Comment