ILog CMS 常用工具(包含启停脚本)

1、编译

直接从:http://git.oschina.net/duzhime/DUZHI_BLOG

PS:

  • 如需要 重新安装 ,则需要删除db.properties
  • J2cache:编译过程中,如遇J2Cache 找不到的话,由于 J2Cache 1.3 的 有BUG;请下载:
    http://git.oschina.net/ld/J2Cache
    编译:mvn install 
    更新 成 j2cache 1.4 后编译
    如使用windows 编译请注释如下:

2、发布

由于本站采用的程序也是直接来源于一个GIT 所以pom.xml 上有部分使用的是适合本站的配置,也请大家尽量参考。

缓存

本站由于是集群环境,所以使用了j2cache,当然如你觉得j2cache 麻烦,也可以使用ehcache;

参考配置如下(other.properties)

luceneDir=../cache/indexes/
ehcacheDir=../cache/.ehcache/
history=false
requestLog=../logs/
#缓存实现
ICacheImpl=io.jpress.cache.impl.JEhCache

如使用j2cache:

luceneDir=../cache/indexes/
ehcacheDir=../cache/.ehcache/
history=false
requestLog=../logs/
#缓存实现
ICacheImpl=io.jpress.cache.impl.J2Cache

j2cache.properties:

#J2Cache configuration


#########################################
# Cache Broadcast Method
# values:
# jgroups -> use jgroups's multicast
# redis -> use redis publish/subscribe mechanism
#########################################

cache.broadcast=redis

#########################################
# Level 1&2 provider
# values:
# none -> disable this level cache
# ehcache -> use ehcache as level 1 cache
# redis -> use redis as level 2 cache
# [classname] -> use custom provider
#########################################

cache.L1.provider_class=ehcache
cache.L2.provider_class=redis

#########################################
# Cache Serialization Provider
# values:
# fst -> fast-serialization
# java -> java standard
# [classname implements Serializer]
#########################################

cache.serialization = fst

#########################################
# Redis connection configuration
#########################################

## connection
redis.host = 10.105.82.28
redis.port = 6379
redis.timeout = 2000
##redis.password =
redis.database = 1

## properties
redis.maxActive = -1
redis.maxIdle = 2000
redis.maxWaitMillis = 100
redis.minEvictableIdleTimeMillis = 864000000
redis.minIdle = 1000
redis.numTestsPerEvictionRun = 10
redis.lifo = false
redis.softMinEvictableIdleTimeMillis = 10
redis.testOnBorrow = true
redis.testOnReturn = false
redis.testWhileIdle = false
redis.timeBetweenEvictionRunsMillis = 300000
redis.blockWhenExhausted = true

10.105.82.28 是我的内网地址,大家可参考;

 

常见脚本:

start_ilogcms_8080.sh //应用启动

::::::::::::::
start_ilogcms_8080.sh
::::::::::::::
#!/bin/sh
info=`sh monitor_ilogcms_8080.sh`
#info=`sh monitor_ilogcms_8080.sh`
#echo ${info}
if [ ${info} = "ok" ];
then
        echo "此进程已经启动了,不能重复启动"
        exit 0;
fi
#echo "test ok"

#exit 0;


PORT=8080
BASE_DIR=~/app/
LIB="${BASE_DIR}/WEB-INF/lib/"


JAVA_OPTS=" -Xmx512m -Xms512m -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=logs/mtdperf.hprof -Dfile.encoding=UTF-8 -Djava.security.egd=file:/dev/./urandom"
START_CLASS="me.duzhi.ilog.cms.Startup"

for libfile in ${LIB}/*.jar ; do
if [ -f $libfile ] ; then
    CLASSPATH=$libfile:${CLASSPATH}
fi
done

for libfile in ${BASE_DIR}/*.jar ; do
if [ -f $libfile ] ; then
    CLASSPATH=$libfile:${CLASSPATH}
fi
done

CLASSPATH=${BASE_DIR}/WEB-INF/classes:${CLASSPATH}
~/java/bin/java ${JAVA_OPTS} -Dport=${PORT} -Dgroup=ilogcms_g1 -DwebDir=${BASE_DIR} -cp ${CLASSPATH} ${START_CLASS} ${PORT} ilogcms_g1 ${BASE_DIR} |cronolog ~/logs/ilo
gcms_g1_${PORT}-%Y%m%d.log >>/dev/null &
t: No such file or directory
[cmsapp@VM_82_28_centos bin]$ more start_ilogcms_8080.sh  
#!/bin/sh
info=`sh monitor_ilogcms_8080.sh`
#info=`sh monitor_ilogcms_8080.sh`
#echo ${info}
if [ ${info} = "ok" ];
then
        echo "此进程已经启动了,不能重复启动"
        exit 0;
fi
#echo "test ok"

#exit 0;


PORT=8080
BASE_DIR=~/app/
LIB="${BASE_DIR}/WEB-INF/lib/"


JAVA_OPTS=" -Xmx512m -Xms512m -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=logs/mtdperf.hprof -Dfile.encoding=UTF-8 -Djava.security.egd=file:/dev/./urandom"
START_CLASS="me.duzhi.ilog.cms.Startup"

for libfile in ${LIB}/*.jar ; do
if [ -f $libfile ] ; then
    CLASSPATH=$libfile:${CLASSPATH}
fi
done

for libfile in ${BASE_DIR}/*.jar ; do
if [ -f $libfile ] ; then
    CLASSPATH=$libfile:${CLASSPATH}
fi
done

CLASSPATH=${BASE_DIR}/WEB-INF/classes:${CLASSPATH}
~/java/bin/java ${JAVA_OPTS} -Dport=${PORT} -Dgroup=ilogcms_g1 -DwebDir=${BASE_DIR} -cp ${CLASSPATH} ${START_CLASS} ${PORT} ilogcms_g1 ${BASE_DIR} |cronolog ~/logs/ilo
gcms_g1_${PORT}-%Y%m%d.log >>/dev/null &

 

more stop_ilogcms_8080.sh //停止应用

#!/bin/sh
#根据进程名杀死进程

sh ~/sbin/stop.sh 8080

 

more monitor_ilogcms_8080.sh //监控进程是否存在

#!/bin/sh

ps aux | grep ilogcms_g1| grep 8080 | grep -v grep >>/dev/null && { echo 'ok' ;  } || { sleep 1 ; echo 'no'; }

stop.sh

#!/bin/sh
#根据进程名杀死进程
if [ $# -lt 1 ]
then
  echo "缺少参数:procedure_name"
  exit 1
fi
 
PROCESS=`ps -ef|grep $1|grep -v grep|grep -v PPID|awk '{ print $2}'`
for i in $PROCESS
do
  echo "Kill the $1 process [ $i ]"
  kill -9 $i
done

 

除特别注明外,本站所有文章均为duzhi原创,转载请注明出处来自https://www.duzhi.me/article/7284.html

联系我们

******

在线咨询:点击这里给我发消息

邮件:ashang.peng#aliyun.com

QR code