bash脚本如何确保不超过一个副本运行?bash脚本如何确保不超过一个副本运行?
我曾尝试:
ps -ef| grep /user/loca/shell/sh | wc -l
这显示了我2因为grep
命令。将其更改为:
ps -ef | grep /user/loca/shell/sh | grep -v 'grep' wc -l
那么它的节目。然而,如果我再vim /user/loca/shell/sh
,然后执行:
ps -ef| grep /user/loca/shell/sh | grep -v 'grep' wc -l
显示2.但是,只有一个过程,我已经开始。
bash脚本如何检查进程是否正在运行?
为/用户/ LOCA /壳/ sh的脚本或编译的可执行文件?我怀疑你需要更仔细地搜索ps输出。请在运行和编辑时显示ps输出。 –
是的,他们正在运行和执行... – joe
请显示ps输出 –