脚本

 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
31
32
33
#!/bin/sh
PRG="$0"

while [ -h "$PRG" ]; do
  ls=`ls -ld "$PRG"`
  link=`expr "$ls" : '.*-> \(.*\)$'`
  if expr "$link" : '/.*' > /dev/null; then
    PRG="$link"
  else
    PRG=`dirname "$PRG"`/"$link"
  fi
done

# Get standard environment variables
PRGDIR=`dirname "$PRG"`
# Only set CATALINA_HOME if not already set
[ -z "$CATALINA_HOME" ] && CATALINA_HOME=`cd "$PRGDIR" >/dev/null; pwd`
#echo $CATALINA_HOME
CLASSPATH=
for i in $CATALINA_HOME/lib/*.jar
do
 CLASSPATH="$CLASSPATH":"$i"
done

CLASSPATH="$CLASSPATH":$CATALINA_HOME/classes
CLASSPATH="$CLASSPATH":$CATALINA_HOME
#echo ${CLASSPATH}
rm -rf classes;
mkdir classes;
ps -ef | grep java | grep -v grep | cut -c 9-15 | xargs kill -s 9

javac -classpath $CLASSPATH -sourcepath src -d classes src/*.java
java -Xms100m -Xmx200m -classpath $CLASSPATH  -Djava.library.path=/usr/local/apr/lib:/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib:. Test