Linux bash脚本,实现查询uwsgi、nginx、mysql、端口等信息
2020-05-30 15:33
92 查看
Linux bash脚本,实现查询uwsgi、nginx、mysql、端口等信息
一、脚本代码
#!/usr/bin/bash
if [ ! -n "$1" ] ; then
echo -e '请输入:\e[1;31m bash fun_ps.sh [nginx|uwsgi|mysql|port 8000] \e[0m'
exit 0
fi
nginx(){
#查询nginx状态和PID
ps -ef | grep nginx
}
uwsgi(){
#查询uwsgi状态和pid
ps -ef | grep uwsgi
}
mysql(){
ps -ef | grep mysql
}
po=$2
port(){
if [ ! -n "$po" ] ; then
echo -e '请输入:\e[1;31m bash fun_ps.sh port 端口号 \e[0m'
exit 0
fi
netstat -anp | grep $po
}
$1
二、调用测试
查端口:bash fun_ps.sh port 8011
查nginx:bash fun_ps.sh nginx
查mysql:bash fun_ps.sh mysql
相关文章推荐
- Bash 脚本实现每次登录到 Shell 时可以查看 Linux 系统信息 | Linux 中国
- Bash 脚本实现每次登录到 Shell 时可以查看 Linux 系统信息
- hackthebox - Haystack (考点:图片信息 & elasticsearch 9200查询 & 端口转发 & Kibana安全 & linux修改脚本提权 )
- Bash 脚本实现每次登录到 Shell 时可以查看 Linux 系统信息
- centos6.2 64位LNMP(linux+nginx+mysql+php)实现
- 开发调试linux服务时几个好用的进程和端口查询命令组合和简单脚本(ps netstat awk grep)
- linux下实现VPS web和mysql数据的备份脚本
- linux mysql自动备份脚本改写实现
- shell脚本实现Linux ip的配置(增删改查)以及相关信息查看
- Shell脚本高级应用 --实现远程MySQL自动查询
- Shell脚本高级应用 --实现远程MySQL自动查询[转
- 利用python脚本实现域名解析和归属地信息查询
- mysql中使用递归实现父级部门所有子级信息的查询
- [linux学习笔记]第2天:时间管理,命令帮助信息,文本查看,权限及用户管理,BASH和变量,脚本
- linux,Centos 6.3 yum安装Nginx+php+Mysql,配置防火墙,开启,关闭端口命令
- Linux下获取电脑硬件配置信息的bash脚本代码
- 在Linux环境下实现一个非常好的bash脚本框架
- 【 Linux 】lvs-dr模型实现HA,后端Nginx、PHP、MySQL分离 搭建wordpress站点
- linux脚本实现scp命令自动输入密码和yes/no等确认信息
- MySQL错误信息:-bash:mysql:command not found(linux mysql 登录MYSQL)