常用的shell脚本整理
启动指定目录下的 tomcat
#!/bin/sh
ROOT="/usr/local/tomcat-server/tomcat-platform/bin"
cd "$ROOT"
nohup startup.sh 1>/dev/null 2>/dev/null &
echo $! > "$ROOT”/platform.pid
Tomcat 重启脚本
#!/bin/bash
cd /usr/local/tomcat-server/tomcat-platform/
tomcat_home=`pwd`
pid=$(ps -ef|grep $tomcat_home|grep -v grep|awk '{print $2}')
if [ $pid ] ;then
kill -9 ${pid[*]}
rm -rf $tomcat_home/temp/* $tomcat_home/work/*
nohup $tomcat_home/bin/startup.sh 1>/dev/null 2>/dev/null &
else
rm -rf $tomcat_home/temp/* $tomcat_home/work/*
nohup $tomcat_home/bin/startup.sh 1>/dev/null 2>/dev/null &
fi