http://m.egloos.zum.com/ilovekms/v/1085447
배치 프로그램 실행시 start,stop,alive shell script
start.sh
#!/bin/sh
export WORK_HOME=/wrk0.d/batch/TxPayBatch
export CLASSPATH=.
export CLASSPATH=$CLASSPATH:"$WORK_HOME"/lib/commons-beanutils-bean-collections.jar
export CLASSPATH=$CLASSPATH:"$WORK_HOME"/lib/commons-beanutils-core.jar
export CLASSPATH=$CLASSPATH:"$WORK_HOME"/lib/commons-beanutils.jar
export CLASSPATH=$CLASSPATH:"$WORK_HOME"/lib/commons-collections-3.1.jar
export CLASSPATH=$CLASSPATH:"$WORK_HOME"/lib/commons-dbcp-1.2.1.jar
export CLASSPATH=$CLASSPATH:"$WORK_HOME"/lib/commons-dbutils-1.0.jar
export CLASSPATH=$CLASSPATH:"$WORK_HOME"/lib/commons-digester-1.7.jar
export CLASSPATH=$CLASSPATH:"$WORK_HOME"/lib/commons-lang-2.1.jar
export CLASSPATH=$CLASSPATH:"$WORK_HOME"/lib/commons-logging-api.jar
export CLASSPATH=$CLASSPATH:"$WORK_HOME"/lib/commons-logging.jar
export CLASSPATH=$CLASSPATH:"$WORK_HOME"/lib/jconn2.jar
export CLASSPATH=$CLASSPATH:"$WORK_HOME"/lib/log4j-1.2.12.jar
export CLASSPATH=$CLASSPATH:"$WORK_HOME"/lib/ojdbc14.jar
export CLASSPATH=$CLASSPATH:"$WORK_HOME"/TxCred.jar
echo javac -d . -classpath "$CLASSPATH" Main.java
javac -d . Main.java
nohup java -Xms128m -Xmx521m Main 2> /dev/null &
echo $! > txCred.pid
stop.sh
pid=`cat txCred.pid`
if [ "$pid" -lt 3 ] ; then
( echo "Batch was not running." ) &
else
kill $pid
#rm $pid
rm -f txCred.pid
( echo "Batch stopped." ) &
fi
alive.sh
pid=`cat txCred.pid`
ps -ef | grep java | grep $pid | awk '{print $2}'
배치 프로그램 실행시 start,stop,alive shell script
start.sh
#!/bin/sh
export WORK_HOME=/wrk0.d/batch/TxPayBatch
export CLASSPATH=.
export CLASSPATH=$CLASSPATH:"$WORK_HOME"/lib/commons-beanutils-bean-collections.jar
export CLASSPATH=$CLASSPATH:"$WORK_HOME"/lib/commons-beanutils-core.jar
export CLASSPATH=$CLASSPATH:"$WORK_HOME"/lib/commons-beanutils.jar
export CLASSPATH=$CLASSPATH:"$WORK_HOME"/lib/commons-collections-3.1.jar
export CLASSPATH=$CLASSPATH:"$WORK_HOME"/lib/commons-dbcp-1.2.1.jar
export CLASSPATH=$CLASSPATH:"$WORK_HOME"/lib/commons-dbutils-1.0.jar
export CLASSPATH=$CLASSPATH:"$WORK_HOME"/lib/commons-digester-1.7.jar
export CLASSPATH=$CLASSPATH:"$WORK_HOME"/lib/commons-lang-2.1.jar
export CLASSPATH=$CLASSPATH:"$WORK_HOME"/lib/commons-logging-api.jar
export CLASSPATH=$CLASSPATH:"$WORK_HOME"/lib/commons-logging.jar
export CLASSPATH=$CLASSPATH:"$WORK_HOME"/lib/jconn2.jar
export CLASSPATH=$CLASSPATH:"$WORK_HOME"/lib/log4j-1.2.12.jar
export CLASSPATH=$CLASSPATH:"$WORK_HOME"/lib/ojdbc14.jar
export CLASSPATH=$CLASSPATH:"$WORK_HOME"/TxCred.jar
echo javac -d . -classpath "$CLASSPATH" Main.java
javac -d . Main.java
nohup java -Xms128m -Xmx521m Main 2> /dev/null &
echo $! > txCred.pid
stop.sh
pid=`cat txCred.pid`
if [ "$pid" -lt 3 ] ; then
( echo "Batch was not running." ) &
else
kill $pid
#rm $pid
rm -f txCred.pid
( echo "Batch stopped." ) &
fi
alive.sh
pid=`cat txCred.pid`
ps -ef | grep java | grep $pid | awk '{print $2}'
'java' 카테고리의 다른 글
자바 한글인코딩 문제 모음 (0) | 2015.08.06 |
---|---|
쓰레드 순차실행 (0) | 2015.06.16 |
DTO로 VO를 쓸것인지 Map을 쓸것인지에 대한 고찰 (0) | 2015.03.05 |
java classpath 파일읽기, properties파일읽기 getResourceAsStream, load properties (0) | 2015.02.26 |
쓰레드 (0) | 2015.02.07 |