📌  相关文章
📜  bash 仅在未运行时启动服务 - Shell-Bash 代码示例

📅  最后修改于: 2022-03-11 14:51:11.743000             🧑  作者: Mango

代码示例1
#!/bin/bash
service=replace_me_with_a_valid_service

if (( $(ps -ef | grep -v grep | grep $service | wc -l) > 0 ))
then
echo "$service is running!!!"
else
/etc/init.d/$service start
fi