1 [root@duanxin bin]# cat setclasspath.sh
2 #!/bin/sh
3 # -----------------------------------------------------------------------------
4 # Set CLASSPATH and Java options
5 #
6 # $Id: setclasspath.sh 345508 2005-11-18 15:54:56Z yoavs $
7 # -----------------------------------------------------------------------------
8
9 # First clear out the user classpath
10 export JAVA_HOME=/usr/local/jdk
11 export JRE_HOME=/usr/local/jdk/jre
知识兔[root@duanxin bin]# cat setclasspath.sh
#!/bin/sh
# -----------------------------------------------------------------------------
# Set CLASSPATH and Java options
#
# $Id: setclasspath.sh 345508 2005-11-18 15:54:56Z yoavs $
# -----------------------------------------------------------------------------
# First clear out the user classpath
export JAVA_HOME=/usr/local/jdk
export JRE_HOME=/usr/local/jdk/jre
知识兔[root@duanxin bin]# cat /nod/jian.sh
#!/bin/sh
TomcatID=$(ps -ef |grep tomcat |grep -v 'grep'|grep -v 'tomcat.log'|awk '{print $2}')
# tomcat启动程序(这里注意tomcat实际安装的路径)
StartTomcat=/usr/local/tomcat/bin/startup.sh
Monitor()
{
echo "[info][$(date +'%F %H:%M:%S')]tomcat情况"
if [[ $TomcatID ]];then # 这里判断TOMCAT进程是否存在
echo "[info]当前tomcat进程ID为:$TomcatID..."
else
echo "[error]tomcat进程不存在!tomcat开始自动重启..."
echo "[info]$StartTomcat,请稍候......"
sh $StartTomcat
fi
echo "------------------------------"
}
Monitor>>/nod/tomcat.log
知识兔
[root@duanxin bin]# cat setclasspath.sh
#!/bin/sh
# -----------------------------------------------------------------------------
# Set CLASSPATH and Java options
#
# $Id: setclasspath.sh 345508 2005-11-18 15:54:56Z yoavs $
# -----------------------------------------------------------------------------
# First clear out the user classpath
export JAVA_HOME=/usr/local/jdk
export JRE_HOME=/usr/local/jdk/jre
知识兔[root@duanxin bin]# cat setclasspath.sh
#!/bin/sh
# -----------------------------------------------------------------------------
# Set CLASSPATH and Java options
#
# $Id: setclasspath.sh 345508 2005-11-18 15:54:56Z yoavs $
# -----------------------------------------------------------------------------
# First clear out the user classpath
export JAVA_HOME=/usr/local/jdk
export JRE_HOME=/usr/local/jdk/jre
知识兔定时任务部分
*/1 * * * * /nod/jian.sh
输出日志