Check number of running scripts using ps

后端 未结 4 410
慢半拍i
慢半拍i 2021-01-15 06:09

I\'m writing a script (show_volume.sh) which may be called several times in short intervals. I need a way to determine whether there is more than just one running instance o

4条回答
  •  终归单人心
    2021-01-15 06:54

    Try to exclude grep as well, as your grep itself also contains show_volume.sh, an example

    ps -a | grep show_volume.sh | grep -v grep | wc -l
    

提交回复
热议问题