#!/usr/bin/env bash BASE_DIR={BASE_DIR}/lib/" JAVA_OPTS=" -Xmx2048m -XX:PermSize=64m -XX:MaxPermSize=512m -XX:+PrintGCDateStamps -XX:+PrintGCDetails -Xloggc:logs/gc.log -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=1 -XX:GCLogFileSize=1024k -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=logs/mtdperf.hprof -server -Dfile.encoding=UTF-8" START_CLASS="com.abc.cde.aaaserver" nohup java {LIB}/*:{START_CLASS} &
如果用-jar,就不能用-cp(-classpath) #!/bin/sh
BASE_DIR={BASE_DIR}/lib/" JAVA_OPTS=" -Xmx2048m -XX:PermSize=64m -XX:MaxPermSize=512m -XX:+PrintGCDateStamps -XX:+PrintGCDetails -Xloggc:logs/gc.log -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=1 -XX:GCLogFileSize=1024k -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=logs/mtdperf.hprof -server -Dfile.encoding=UTF-8" START_CLASS="com.tencent.bugly.EiServer"
echo ${LIB}
for libfile in libfile ] ; then CLASSPATH={CLASSPATH} fi done
for libfile in libfile ] ; then CLASSPATH={CLASSPATH} fi done
CLASSPATH={CLASSPATH} nohup "java" {CLASSPATH} ${START_CLASS} &
使用nohup是为了避免账户注销发送的hup信号,会导致该账户调用的程序注销,使用nohup会忽略此信号。
语句最后的&表示该进程在后台运行