앱)자바 batch pid 파일 만들기
==main==
//pid file creation
String pidDir = System.getProperty("pid.dir", jobmgrHome+System.getProperty("file.separator")+"pid")
try{
PidUtil pidUtil = new PidUtil(pidDir, "jobmanager.pid");
if(pidUtil.existPidFile()){
LoggerUtil.error(logger, "already running...");
String pid = pidUtil.readPidFile();
LoggerUtil.error(logger,"pid: "+pid);
System.exit(0);
}
String pid = pidUtil.createPidFile();
LoggerUtil.info(logger, "PID file created. <pid : "+pid + ">");
}catch(IOException ie){
ie.printStackTrace();
}
}
==PidUtil==
public class PidUtil{
private String pidDir;
private String pidFileName;
pulbic PidUtil(String pidDirectory, String pidFileName) {
makeDir(pidDirectory);
this.pidFileName = pidFileName;
pidDir = new File(pidDirectory).getPath();
}
public File getPidFile(){
return new File(pidDir + System.getProperty("file.separator")+pidFileName);
}
public String getPID() throws IOException{
String str = ManagementFactory.getRuntimeMXBean().getName();
return str.split("@")[0];
}
public String createPidFile() throws IOException{
String pid = null;
pid = getPID();
//파일 생성
writePID(getPidFile(), pid);
return pid;
}
public void deletePID(){
delete(getPidFile());
}
public String readPidFile() throws IOException{
return readFile(getPidFile());
}
public boolean existPidFile() throws IOException{
boolean isRet = false;
//pid파일 존재하는지 체크한다.
//파일 존재할 경우 pid 정보를 읽는다
//pid가 -1인 경우 실패한 경우이므로 pid파일이 존재하지 않는다는 결과를 반환한다
//pid가 -1가 아닌 경우 windows 2000이면 tilst로 해당 pid를 체크하고 windows 2000이상이면 tasklist로 체크한다
if(getPidFile().exist()){
String pid = readFile(getPidFile());
if( !pid.equals("-1")){
String winOsName = System.getProperty("os.name");
boolean isWindow = winOsName.startWith("Windows");
if( isWindow) {//windows
if(winOsName.indexOf("2000") > -1) {
if(hasProcess(pid, "tlist")){
isRet = true;
}
}else{
if(hasProcess(pid, "tasklist")){
isRet = false;
}
}
}else{//linux & unix
if(hasProcess(pid, "ps -p "+ pid)){
isRet = true;
}
}
}
}
return isRet;
}
private boolean hasProcess(String pid, String checkCMD) throws IOException{
boolean isRet = false;
Process p_start = Runtime.getRuntime().exec(checkCMD);
BufferedReader stdout = new BufferedReader (new InputStreamReader(p_start.getInputStream()));
String output;
while((output=stdout.readLine())!=null){
if(output.indexOf(pid) > -1 && (output.startsWith("java") || output.indexOf("java") > -1)){
isRet = true;
break;
}
}
p_start.destory();
return isRet;
}
private void writePID(File file, String pid) throws IOException{
FileWriter fw = null;
try{
fw=new FileWriter(file);
fw.write(pid);
fw.close();
}catch (IOException ioe){
throw ioe;
}finally{
if(fw != null){
fw.close();
}
}
}
public synchronized void makeDir(String path){
File dir = new File(path);
if( !dir.exists()){
dir.mkdirs();
}
}
public String readFile(File file) throws IOException{
FileReader fileReader = null;
String s = null;
try{
fileReader = new FileReader(file);
s = readReader(fileReader);
} finally{
if( fileReader != null){
fileReader.close();
}
}
return s;
}
public void delete(File file){
if(file != null){
if(file.exists()){
file.delete();
}
}
}
public String readReader(Reader input) throws IOException{
try{
StringBuffer buf = new StringBuffer();
BufferedReader in = new BufferedReader(input);
int ch;
while((ch=in.read())!= -1){
buf.append((char)ch);
}
return buf.toString();
}finally{
input.close();
}
}
}
===우분투 스크립트(메인 스크립트)
#!/bin/bash
NAME="batch"
DEFAULT = "opt/~/env.sh"
DESC="~~~~Batch Application Serve for $NAME"
#check privilegs
if [ ' id -u' -ne 0 ]; then
echo "You need root privileges to run this script"
exit 1
fi
# Make sure wildfly is started with system locale
if [ -r /etc/default/locale ]; then
. /etc/default/locale
export LANG
fi
# Overwrite settings from default file
if [ -f "$DEFAULT" ]; then
. "$DEFAULT:
fi
# Setup the JVM
if [ -z "$JAVA" ]; then
if [ -n "$JAVA_HOME" ]; then
JAVA="$JAVA_HOME/bin/java"
else
JAVA="java"
fi
fi
# Check if wildfly is installed
if [ ! -f "$JOBMGR_HOME/JobMnager.jar" ]; then
log_failure_msg "$NAME is not installed in \"$JOBMGR_HOME\""
exit 1
fi
if [ -z "$JOBMGR_USER" ]; then
JOBMGR_USER=root
fi
# Check wilfly user
id $JOBMGR_USER > /dev/null 2>&1
if [ $? -ne 0 -o -z "$JOBMGR_USER" ]; then
log_failure_msg "User \"$JOBMGR_USER\" does not exist..."
exit 1
fi
# Check owner of JOBMGR_HOME
if [ ! $(stat -L -c "%U" "$JOBMGR_HOME") = $JOBMGR_USER ]; then
log_failure_msg "The user \"$JOBMGR_USER\" is not owner of \"$JOBMGR_HOME\""
exit 1
fi
# The amount of time to wait for startup
if [ -z "$STARTUP_WAIT" ]; then
STARTUP_WAIT=120
fi
# The amount of time to wait for shutdown
if [ -z "$SHUTDOWN_WAIT" ]; then
SHUTDOWN_WAIT=120
fi
# Location to keep the console log
if [ -z "JOBMGR_CONSOLE_LOG" ]; then JOBMGR_CONSOLE_LOG="$JOBMGR_HOME/logs/console.log"
fi
export JOBMGR_CONSOLE_LOG
touch $JOBMGR_CONSOLE_LOG
chown $JOBMGR_USER $JOBMGR_CONSOLE_LOG
# Location to set the pid file
JOBMGR_PIDFILE="$JOBMGR_HOME/pid/jobmanager.pid"
export JOBMGR_PIDFILE
# Helper functions to check status of Jboss services
check_status() {
echo "pidofproc -p \"$JOBMGR_PIDFILE\" \"$JAVA\" >/dev/null 2>&1"
pidofproc -p "$JOBMGR_PIDFILE" "$JAVA" >/dev/null 2>&1
}
case "$1" in
start)
log_daemon_msg "Starting $DESC"
check_status
status_start=$?
if [ $status_start -eq 3 ]; then
cat /dev/null > "$JOBMGR_CONSOLE_LOG"
source $DEFAULT; java $JOBMGR_OPTS $JAVA_OPTS -jar JobManager.jar > ${JOBMGR_CONSOLE_LOG} 2>&1 &"
count=0
launched=0
until [ $count -gt $STARTUP_WAIT ]
do
if check_status; then
launched=1
break
fi
sleep 1
count=$((count + 1));
done
if [ $launched -eq 1 ]; then
chown $JOBMGR_USER $(dirname "$JOBMGR_PIDFILE") || true
fi
if check_status; then
log_end_msg 0
else
log_end_msg 1
fi
if [ $launched -eq 0 ]; then
log_warning_msg "$DESC hasn't started within the timeout allowed"
log_warning_msg "please review file \"$JOBMGR_CONSOLE_LOG\" to see the status of the service"
fi
elif [ $status_start -eq 1 ]; then
log_failure_msg "$DESC is not running but the pid file exists"
exit 1
elif [ $status_start -eq 0 ]; then
log_success_msg "$DESC (already running)"
fi
;;
stop)
check_status
status_stop=$?
if [ $status_stop -eq 0 ]; then
read kpid < "$JOBMGR_PIDFILE"
log_daemon_msg "Stopping $DESC"
if check_status; then
kill $kpid
fi
rm "$JOBMGR_PIDFILE"
log_end_msg 0
elif [ $status_stop -eq 1 ]; then
log_action_msg "$DESC is not running but the pid file exists, cleaning up"
rm -f $JOBMGR_PIDFILE
elif [ $status_stop -eq 3 ]; then
log_action_msg "$DESC is not running"
fi
;;
restart)
check_status
status_restart=$?
if [ $status_restart -eq 0 ]; then
$0 stop
fi
$0 start
;;
status)
check_status
status=$?
if [ $status -eq 0 ]; then
read pid < $JOBMGR_PIDFILE
log_action_msg "$DESC is running with pid $pid"
exit 0
elif [ $status -eq 1 ]; then
log_action_msg "$DESC is not running and the pid file exists"
exit 1
elif [ $status -eq 3 ]; then
log_action_msg "$DESC is not running"
exit 3
else
log_action_msg "Unable to determine $NAME status"
exit 4
fi
;;
*)
log_action_msg "Usage: $0 {start|stop|restart|status}"
exit 2
;;
esac
exit 0
===우분투 스크립트(env 스크립트)
env.sh파일임
#!/bin/bash
export SERVER_HOME="/opt"
export SERVER_NAME="Batch"
export JOBMGR_HOME="${SERVER_HOME}/${SERVER_NAME}"
export SERVER_TYPE="Dev"
LIB_DIR=${JOBMGR_HOME}/lib
export JAVA_HOME=/opt/java
export CLASSPATH=.:/opt/java/jre/lib:$LIB_DIR
export PATH=$JAVA_HOME/bin:$PATH
if [ "x$JOBMGR_OPTS" ="x" ]; then
JOBMGR_OPTS="-Djobmanager"
JOBMGR_OPTS="$JOBMGR_OPTS -Djobmgr.home=${JOBMGR_HOME}"
JOBMGR_OPTS="$JOBMGR_OPTS -Dserver.type=${SERVER_TYPE}"
JOBMGR_OPTS="$JOBMGR_OPTS -Djobmgr.resourcepath=file:${JOBMGR_HOME}/conf/"
fi
if [ "x$JAVA_OPTS" = "x" ]; then
JAVA_OPTS="-server"
JAVA_OPTS="$JAVA_OPTS -noverify"
JAVA_OPTS="$JAVA_OPTS -Xms512m"
JAVA_OPTS="$JAVA_OPTS -Xmx5124m"
JAVA_OPTS="$JAVA_OPTS -XX:NewRatio=7" #전체 메모리의 3/4를 old generation 영역으로 지정
JAVA_OPTS="$JAVA_OPTS -XX:PermSize=64m"
JAVA_OPTS="$JAVA_OPTS -XX:MaxPermSize=128m"
JAVA_OPTS="$JAVA_OPTS -XX:+UseParNewGC" #Young Generation 영역에서 parrel로 GC를 수행하도록 한다
JAVA_OPTS="$JAVA_OPTS -XX:+UseConcMarkSweepGC" #CMS Controller 활성화
JAVA_OPTS="$JAVA_OPTS -XX:+CMSParallelRemarkEnabled" #Remark 단계를 Parallel로 동작하도록 지정
JAVA_OPTS="$JAVA_OPTS -XX:CMSFullGCsBeforeCompaction=0" # Concurrent Full GC는 항상 Compaction을 수반하도록 한다
JAVA_OPTS="$JAVA_OPTS -XX:+ExplicitGCInvokesConcurrent" #system.gc() 하더라도 CMS GC를 실행하도록 한다
JAVA_OPTS="$JAVA_OPTS -verbose:gc"
JAVA_OPTS="$JAVA_OPTS -Xloggc:$JOBMGR_HOME/gclog/gc_'date "+%Y%m%d%H"'.log"
JAVA_OPTS="$JAVA_OPTS -XX:+PrintGCDetails" # GC에 대한 상세출력
JAVA_OPTS="$JAVA_OPTS -XX:+PrintGCDateStamps" # 시스템 날짜 기록
JAVA_OPTS="$JAVA_OPTS -XX:+PrintHeapAtGC"
JAVA_OPTS="$JAVA_OPTS -XX:+HeapDumpOnOutOfMemoryError"
JAVA_OPTS="$JAVA_OPTS -XX:HeapDumpPath=$JOBMGR_HOME/gclog/java_pid.hprof"
JAVA_OPTS="$JAVA_OPTS -Djava.security.egd=file:/dev/./urandom"
JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote"
JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.port=8286"
JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.ssl=false"
JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.authenticate=false"
JAVA_OPTS="$JAVA_OPTS -Djava.net.preferIPv4Stack=true"
JAVA_OPTS="$JAVA_OPTS -Dsun.lang.ClassLoader.allowArraySyntax=true"
JAVA_OPTS="$JAVA_OPTS -Dsun.net.inetaddr.ttl=10"
JAVA_OPTS="$JAVA_OPTS -Dsun.net.inetaddr.negative.ttl.10"
fi
export JAVA_OPTS JOBMGR_OPTS
//pid file creation
String pidDir = System.getProperty("pid.dir", jobmgrHome+System.getProperty("file.separator")+"pid")
try{
PidUtil pidUtil = new PidUtil(pidDir, "jobmanager.pid");
if(pidUtil.existPidFile()){
LoggerUtil.error(logger, "already running...");
String pid = pidUtil.readPidFile();
LoggerUtil.error(logger,"pid: "+pid);
System.exit(0);
}
String pid = pidUtil.createPidFile();
LoggerUtil.info(logger, "PID file created. <pid : "+pid + ">");
}catch(IOException ie){
ie.printStackTrace();
}
}
==PidUtil==
public class PidUtil{
private String pidDir;
private String pidFileName;
pulbic PidUtil(String pidDirectory, String pidFileName) {
makeDir(pidDirectory);
this.pidFileName = pidFileName;
pidDir = new File(pidDirectory).getPath();
}
public File getPidFile(){
return new File(pidDir + System.getProperty("file.separator")+pidFileName);
}
public String getPID() throws IOException{
String str = ManagementFactory.getRuntimeMXBean().getName();
return str.split("@")[0];
}
public String createPidFile() throws IOException{
String pid = null;
pid = getPID();
//파일 생성
writePID(getPidFile(), pid);
return pid;
}
public void deletePID(){
delete(getPidFile());
}
public String readPidFile() throws IOException{
return readFile(getPidFile());
}
public boolean existPidFile() throws IOException{
boolean isRet = false;
//pid파일 존재하는지 체크한다.
//파일 존재할 경우 pid 정보를 읽는다
//pid가 -1인 경우 실패한 경우이므로 pid파일이 존재하지 않는다는 결과를 반환한다
//pid가 -1가 아닌 경우 windows 2000이면 tilst로 해당 pid를 체크하고 windows 2000이상이면 tasklist로 체크한다
if(getPidFile().exist()){
String pid = readFile(getPidFile());
if( !pid.equals("-1")){
String winOsName = System.getProperty("os.name");
boolean isWindow = winOsName.startWith("Windows");
if( isWindow) {//windows
if(winOsName.indexOf("2000") > -1) {
if(hasProcess(pid, "tlist")){
isRet = true;
}
}else{
if(hasProcess(pid, "tasklist")){
isRet = false;
}
}
}else{//linux & unix
if(hasProcess(pid, "ps -p "+ pid)){
isRet = true;
}
}
}
}
return isRet;
}
private boolean hasProcess(String pid, String checkCMD) throws IOException{
boolean isRet = false;
Process p_start = Runtime.getRuntime().exec(checkCMD);
BufferedReader stdout = new BufferedReader (new InputStreamReader(p_start.getInputStream()));
String output;
while((output=stdout.readLine())!=null){
if(output.indexOf(pid) > -1 && (output.startsWith("java") || output.indexOf("java") > -1)){
isRet = true;
break;
}
}
p_start.destory();
return isRet;
}
private void writePID(File file, String pid) throws IOException{
FileWriter fw = null;
try{
fw=new FileWriter(file);
fw.write(pid);
fw.close();
}catch (IOException ioe){
throw ioe;
}finally{
if(fw != null){
fw.close();
}
}
}
public synchronized void makeDir(String path){
File dir = new File(path);
if( !dir.exists()){
dir.mkdirs();
}
}
public String readFile(File file) throws IOException{
FileReader fileReader = null;
String s = null;
try{
fileReader = new FileReader(file);
s = readReader(fileReader);
} finally{
if( fileReader != null){
fileReader.close();
}
}
return s;
}
public void delete(File file){
if(file != null){
if(file.exists()){
file.delete();
}
}
}
public String readReader(Reader input) throws IOException{
try{
StringBuffer buf = new StringBuffer();
BufferedReader in = new BufferedReader(input);
int ch;
while((ch=in.read())!= -1){
buf.append((char)ch);
}
return buf.toString();
}finally{
input.close();
}
}
}
===우분투 스크립트(메인 스크립트)
#!/bin/bash
NAME="batch"
DEFAULT = "opt/~/env.sh"
DESC="~~~~Batch Application Serve for $NAME"
#check privilegs
if [ ' id -u' -ne 0 ]; then
echo "You need root privileges to run this script"
exit 1
fi
# Make sure wildfly is started with system locale
if [ -r /etc/default/locale ]; then
. /etc/default/locale
export LANG
fi
# Overwrite settings from default file
if [ -f "$DEFAULT" ]; then
. "$DEFAULT:
fi
# Setup the JVM
if [ -z "$JAVA" ]; then
if [ -n "$JAVA_HOME" ]; then
JAVA="$JAVA_HOME/bin/java"
else
JAVA="java"
fi
fi
# Check if wildfly is installed
if [ ! -f "$JOBMGR_HOME/JobMnager.jar" ]; then
log_failure_msg "$NAME is not installed in \"$JOBMGR_HOME\""
exit 1
fi
if [ -z "$JOBMGR_USER" ]; then
JOBMGR_USER=root
fi
# Check wilfly user
id $JOBMGR_USER > /dev/null 2>&1
if [ $? -ne 0 -o -z "$JOBMGR_USER" ]; then
log_failure_msg "User \"$JOBMGR_USER\" does not exist..."
exit 1
fi
# Check owner of JOBMGR_HOME
if [ ! $(stat -L -c "%U" "$JOBMGR_HOME") = $JOBMGR_USER ]; then
log_failure_msg "The user \"$JOBMGR_USER\" is not owner of \"$JOBMGR_HOME\""
exit 1
fi
# The amount of time to wait for startup
if [ -z "$STARTUP_WAIT" ]; then
STARTUP_WAIT=120
fi
# The amount of time to wait for shutdown
if [ -z "$SHUTDOWN_WAIT" ]; then
SHUTDOWN_WAIT=120
fi
# Location to keep the console log
if [ -z "JOBMGR_CONSOLE_LOG" ]; then JOBMGR_CONSOLE_LOG="$JOBMGR_HOME/logs/console.log"
fi
export JOBMGR_CONSOLE_LOG
touch $JOBMGR_CONSOLE_LOG
chown $JOBMGR_USER $JOBMGR_CONSOLE_LOG
# Location to set the pid file
JOBMGR_PIDFILE="$JOBMGR_HOME/pid/jobmanager.pid"
export JOBMGR_PIDFILE
# Helper functions to check status of Jboss services
check_status() {
echo "pidofproc -p \"$JOBMGR_PIDFILE\" \"$JAVA\" >/dev/null 2>&1"
pidofproc -p "$JOBMGR_PIDFILE" "$JAVA" >/dev/null 2>&1
}
case "$1" in
start)
log_daemon_msg "Starting $DESC"
check_status
status_start=$?
if [ $status_start -eq 3 ]; then
cat /dev/null > "$JOBMGR_CONSOLE_LOG"
source $DEFAULT; java $JOBMGR_OPTS $JAVA_OPTS -jar JobManager.jar > ${JOBMGR_CONSOLE_LOG} 2>&1 &"
count=0
launched=0
until [ $count -gt $STARTUP_WAIT ]
do
if check_status; then
launched=1
break
fi
sleep 1
count=$((count + 1));
done
if [ $launched -eq 1 ]; then
chown $JOBMGR_USER $(dirname "$JOBMGR_PIDFILE") || true
fi
if check_status; then
log_end_msg 0
else
log_end_msg 1
fi
if [ $launched -eq 0 ]; then
log_warning_msg "$DESC hasn't started within the timeout allowed"
log_warning_msg "please review file \"$JOBMGR_CONSOLE_LOG\" to see the status of the service"
fi
elif [ $status_start -eq 1 ]; then
log_failure_msg "$DESC is not running but the pid file exists"
exit 1
elif [ $status_start -eq 0 ]; then
log_success_msg "$DESC (already running)"
fi
;;
stop)
check_status
status_stop=$?
if [ $status_stop -eq 0 ]; then
read kpid < "$JOBMGR_PIDFILE"
log_daemon_msg "Stopping $DESC"
if check_status; then
kill $kpid
fi
rm "$JOBMGR_PIDFILE"
log_end_msg 0
elif [ $status_stop -eq 1 ]; then
log_action_msg "$DESC is not running but the pid file exists, cleaning up"
rm -f $JOBMGR_PIDFILE
elif [ $status_stop -eq 3 ]; then
log_action_msg "$DESC is not running"
fi
;;
restart)
check_status
status_restart=$?
if [ $status_restart -eq 0 ]; then
$0 stop
fi
$0 start
;;
status)
check_status
status=$?
if [ $status -eq 0 ]; then
read pid < $JOBMGR_PIDFILE
log_action_msg "$DESC is running with pid $pid"
exit 0
elif [ $status -eq 1 ]; then
log_action_msg "$DESC is not running and the pid file exists"
exit 1
elif [ $status -eq 3 ]; then
log_action_msg "$DESC is not running"
exit 3
else
log_action_msg "Unable to determine $NAME status"
exit 4
fi
;;
*)
log_action_msg "Usage: $0 {start|stop|restart|status}"
exit 2
;;
esac
exit 0
===우분투 스크립트(env 스크립트)
env.sh파일임
#!/bin/bash
export SERVER_HOME="/opt"
export SERVER_NAME="Batch"
export JOBMGR_HOME="${SERVER_HOME}/${SERVER_NAME}"
export SERVER_TYPE="Dev"
LIB_DIR=${JOBMGR_HOME}/lib
export JAVA_HOME=/opt/java
export CLASSPATH=.:/opt/java/jre/lib:$LIB_DIR
export PATH=$JAVA_HOME/bin:$PATH
if [ "x$JOBMGR_OPTS" ="x" ]; then
JOBMGR_OPTS="-Djobmanager"
JOBMGR_OPTS="$JOBMGR_OPTS -Djobmgr.home=${JOBMGR_HOME}"
JOBMGR_OPTS="$JOBMGR_OPTS -Dserver.type=${SERVER_TYPE}"
JOBMGR_OPTS="$JOBMGR_OPTS -Djobmgr.resourcepath=file:${JOBMGR_HOME}/conf/"
fi
if [ "x$JAVA_OPTS" = "x" ]; then
JAVA_OPTS="-server"
JAVA_OPTS="$JAVA_OPTS -noverify"
JAVA_OPTS="$JAVA_OPTS -Xms512m"
JAVA_OPTS="$JAVA_OPTS -Xmx5124m"
JAVA_OPTS="$JAVA_OPTS -XX:NewRatio=7" #전체 메모리의 3/4를 old generation 영역으로 지정
JAVA_OPTS="$JAVA_OPTS -XX:PermSize=64m"
JAVA_OPTS="$JAVA_OPTS -XX:MaxPermSize=128m"
JAVA_OPTS="$JAVA_OPTS -XX:+UseParNewGC" #Young Generation 영역에서 parrel로 GC를 수행하도록 한다
JAVA_OPTS="$JAVA_OPTS -XX:+UseConcMarkSweepGC" #CMS Controller 활성화
JAVA_OPTS="$JAVA_OPTS -XX:+CMSParallelRemarkEnabled" #Remark 단계를 Parallel로 동작하도록 지정
JAVA_OPTS="$JAVA_OPTS -XX:CMSFullGCsBeforeCompaction=0" # Concurrent Full GC는 항상 Compaction을 수반하도록 한다
JAVA_OPTS="$JAVA_OPTS -XX:+ExplicitGCInvokesConcurrent" #system.gc() 하더라도 CMS GC를 실행하도록 한다
JAVA_OPTS="$JAVA_OPTS -verbose:gc"
JAVA_OPTS="$JAVA_OPTS -Xloggc:$JOBMGR_HOME/gclog/gc_'date "+%Y%m%d%H"'.log"
JAVA_OPTS="$JAVA_OPTS -XX:+PrintGCDetails" # GC에 대한 상세출력
JAVA_OPTS="$JAVA_OPTS -XX:+PrintGCDateStamps" # 시스템 날짜 기록
JAVA_OPTS="$JAVA_OPTS -XX:+PrintHeapAtGC"
JAVA_OPTS="$JAVA_OPTS -XX:+HeapDumpOnOutOfMemoryError"
JAVA_OPTS="$JAVA_OPTS -XX:HeapDumpPath=$JOBMGR_HOME/gclog/java_pid.hprof"
JAVA_OPTS="$JAVA_OPTS -Djava.security.egd=file:/dev/./urandom"
JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote"
JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.port=8286"
JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.ssl=false"
JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.authenticate=false"
JAVA_OPTS="$JAVA_OPTS -Djava.net.preferIPv4Stack=true"
JAVA_OPTS="$JAVA_OPTS -Dsun.lang.ClassLoader.allowArraySyntax=true"
JAVA_OPTS="$JAVA_OPTS -Dsun.net.inetaddr.ttl=10"
JAVA_OPTS="$JAVA_OPTS -Dsun.net.inetaddr.negative.ttl.10"
fi
export JAVA_OPTS JOBMGR_OPTS
'백엔드개발 > 자바스프링' 카테고리의 다른 글
앱)logback 한줄 로그 나오게 하는 방법 (0) | 2018.06.08 |
---|---|
앱)AWS S3 Util java spring 예제 샘플 (0) | 2018.06.08 |
앱)jar 파일 실행하는 법 정리 (0) | 2018.04.13 |
스프링 프레임워크 메인 프로젝트 Spring framework project (0) | 2018.04.05 |
앱)logback.xml sample example (0) | 2018.04.04 |