首页 > 系统服务 > 详细

linux-启动停止重启shell 简单shell示例

时间:2016-09-21 12:57:47      阅读:308      评论:0      收藏:0      [点我收藏+]

停止:

#!/bin/bash
pid=`ps -ef|grep /opt/lampp|grep -v grep|awk ‘{print $2}‘|wc -l`
b=0
if [ $pid -gt $b ]
then
ps -ef|grep /opt/lampp|grep -v grep|awk ‘{print $2}‘|xargs kill -9
echo "lammp has stopped!"
else
echo "lammp is not running!"
fi
启动:

#!/bin/bash
pid=`ps -ef|grep /opt/lampp|grep -v grep|awk ‘{print $2}‘|wc -l`
b=0
if [ $pid -gt $b ]
then
echo "lammp is already running!"
else
/opt/lampp/lampp start
echo "lammp has started!"
tail -f /opt/lampp/logs/access_log
fi

重启:

/tmp/stopl.sh
/tmp/startl.sh
~

linux-启动停止重启shell 简单shell示例

原文:http://www.cnblogs.com/lingxia/p/5892092.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!