linux - 检查服务是否通过 bash 脚本运行
问题描述
我有一个脚本sh startAWS.sh
。最重要的是,我检查了这个:
if [[ `ps -acx|grep postgres|wc -l` < 1 ]]; then
echo "You need to start your Postgres service to run this script."
ps -acx|grep postgres|wc -l
exit 0
fi
当我跑步时,我得到了
⚡️ laravel sh startAWS.sh
You need to start your Postgres service to run this script.
6
嗯……什么……♂️</p>
我的 Postgres 正在运行,不应执行该回显。
它表明6
,并且 6 不小于 1,该代码不应该被执行。
有谁知道为什么我的 echo 打印出来了?
解决方案
推荐阅读
- python - Tensorflow .pb 文件到 coreml 模型:'Unsupported Ops of type: AddV2'
- c - 限制进程在linux中读取“/etc/resolv.conf”文件
- arrays - 如何在 JSON 中传递数组
- swagger - Swagger:使用正文的获取方法不起作用也更改为查询,路径,标题仍然不起作用
- python - 如何在 Spyder 4 中运行选定的行?
- vimeo - 使用 vimeo API 访问统计信息
- rust - 我的类似 RefCell 的结构上的 borrow_mut() 不起作用
- ubuntu-16.04 - 如何从 ubuntu 16.04 服务器完全卸载 collectd
- azure - 如何为 Azure Kubernetes 集群创建 TCP/IP 负载均衡器/应用程序网关
- javascript - React axios put请求返回错误500