码迷,mamicode.com
首页 > 系统相关 > 详细

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

时间:2016-09-21 12:58:16      阅读:162      评论: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
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!