初学Linux之简单的Shell
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了初学Linux之简单的Shell相关的知识,希望对你有一定的参考价值。
先占坑,回头补充完善哈
#!/bin/bash
# Program:
# This program is used to stop tomcat.
# History:
# 2016/09/11 XH First release
pid=`ps -ef|grep tomcat|grep -v grep|awk ‘{print $2}‘`
if [ $pid ]
then
echo ‘Tomcat is already running..‘
else
/opt/tomcat7/bin/startup.sh
echo ‘Tomcat has just been started..‘
tail -f /opt/tomcat7/logs/catalina.out
fi
pid=`ps -ef|grep tomcat|grep -v grep|awk ‘{print $2}‘`
if [ $pid ]
then
echo ‘Tomcat is alread running..pid is --> $pid‘
else
echo ‘Tomcat has just been started..‘
fi
以上是关于初学Linux之简单的Shell的主要内容,如果未能解决你的问题,请参考以下文章