linux-启动停止重启shell 简单shell示例
停止:
#!/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示例的更多相关文章
- Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’解决方法 + Linux启动/停止/重启Mysql数据库的方法
启动mysql 报错: ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/lib/mysql/m ...
- Linux启动/停止/重启Mysql数据库的方法
1.查看mysql版本 方法一:status; 方法二:select version(); 2.Mysql启动.停止.重启常用命令 a.启动方式 1.使用 service 启动: [root@loca ...
- Linux启动/停止/重启Mysql数据库的方法——转载
Mysql启动.停止.重启常用命令 a.启动方式1.使用 service 启动:[root@localhost /]# service mysqld start (5.0版本是mysqld)[root ...
- Linux启动/停止/重启Mysql数据库
1.查看mysql版本 1)status; 2)select version(); 2.Mysql启动 1)使用 service 启动: service mysqld start (5.0版本是mys ...
- Linux启动/停止/重启gitlab
# Start all GitLab components sudo gitlab-ctl start # Stop all GitLab components sudo gitlab-ctl sto ...
- linux系统下重启tomcat的shell脚本
linux系统下重启tomcat的shell脚本: #!/bin/shtomcat_home=/opt/apache-tomcat- #找到tomcat进程的id并kill掉 ps -ef |grep ...
- Linux Systemd——在RHEL/CentOS 7中启动/停止/重启服务
RHEL/CentOS 7.0中一个最主要的改变,就是切换到了systemd.它用于替代红帽企业版Linux前任版本中的SysV和Upstart,对系统和服务进行管理.systemd兼容SysV和Li ...
- linux 下停止java jar包 shell
linux 下停止java jar包 shell http://injavawetrust.iteye.com #!/bin/sh APP_HOME=/home/ap/injavawetrust/ba ...
- linux如何启动/停止/重启MySQL
如何启动/停止/重启MySQL 一.启动方式 1.使用 service 启动:service mysqld start2.使用 mysqld 脚本启动:/etc/inint.d/mysqld star ...
- 在CentOS 7中启动/停止/重启服务
RHEL/CentOS 7.0中一个最主要的改变,就是切换到了systemd.它用于替代红帽企业版Linux前任版本中的SysV和Upstart,对系统和服务进行管理.systemd兼容SysV和Li ...
随机推荐
- php,Allowed memory size of 8388608 bytes exhausted (tried to allocate 1298358 bytes)
修改apache上传文件大小限制 PHP上传文件大小限制解决方法: 第一: 在php.ini里面查看如下行: upload_max_filesize = 8M post_max_size = 1 ...
- ActiveMQ的消息确认问题
http://riddickbryant.iteye.com/blog/441890 [发送端] session = connection.createSession(Boolean.FALSE, ...
- [转]NTLM身份验证
链接:http://www.360doc.com/content/12/0615/14/10216164_218320534.shtml 在允许的环境下,Kerberos是首选的认证方式.在这之前,W ...
- EXTJS项目实战经验总结一:日期组件的change事件:
1 依据选择的日期,加载相应的列表数据,如图: 开发说明 1 开发思路: 在日期值变化的事件中获得选择后的日期值,传给后台,然后从后台加载相应的数据 2 问题:在查看extjs2.2 的a ...
- 使用Python脚本进行域名解析
因为在研究爬虫,所以也了解了下域名解析.要提高爬虫的效率,就需要提高域名解析的效率.我将爬虫记录下的域名作为待解析的域名来测试各域名解析方法的效率.我尝试以下四种方法:1. 单线程依次解析各域名,2. ...
- Flexigrid在IE下不显示数据的处理
文章总结自我的论坛提问: http://bbs.csdn.net/topics/390498434?page=1#post-394918028 解决方法: 网上的答案经我验证都是不靠谱的,以后大家就知 ...
- tomcat配置文件server.xml具体解释
元素名 属性 解释 server port 指定一个port,这个port负责监听关闭tomcat 的请求 shutdown 指定向port发送的命令字符串 service name 指定servic ...
- Python int与string之间的转化
string-->int 1.10进制string转化为int int('12') 2.16进制string转化为int int('12', 16) int-->string 1.int转 ...
- 从零开始学android开发-项目重命名
--修改项目名称 选中项目-[refactor]-[rename] --修改package名称 选中需要重命名的包-[refactor]-[rename] --修改gen下面的名称 打开Android ...
- AIM Tech Round (Div. 2) B. Making a String 贪心
B. Making a String 题目连接: http://codeforces.com/contest/624/problem/B Description You are given an al ...