书写关于tomcat的脚本
我自己写了一个关于tomcat的运行的脚本,反正tomcat启动的精髓都是一样的哈#!/bin/bash
read -p "enter the service you want to do T/O " TF
read -p "enter the service status you want to operate stop/start) " ST
TPID=`ps aux | grep tomcat | grep -v "grep"|awk '{print $2}'`
OPID=`ps aux | grep openfire | grep -v "grep"|awk '{print $2}'`
if [ "$TF" == "t" ]||[ "$TF" == "T" ]; then
if [ "$ST" == "stop" ]; then
echo "tomcat will be stopped"
if [[ ! -n "$TPID" ]]; then
echo "the tomcat service is not running"
exit 0
else
echo "stoping service tomcat"
kill -9 $TPID
echo "tomcat is stopped"
fi
else
if [ "$ST" == "start" ]; then
echo "tomcat will be started"
read -p "enter the service directory you want to start tomcat" DR
if [ -x $DR/bin/startup.sh ]; then
cd $DR/bin
sh startup.sh
else
echo "pehaps you do not have right to run startup.sh"
fi
exit 0
fi
echo "input the right status you want tomcat to be"
fi
echo "input the right letter"
exit 0
fi
http://blog.运维网.com/attachment/201312/164151434.png
嗯,这个地方要注意的呢是还是脚本的空格,该有的能少啦
还有openfire的半边,我就不贴出来啦
页:
[1]