How to make sure only one instance of a Bash script is running at a time?

前端 未结 6 1866
时光取名叫无心
时光取名叫无心 2021-02-08 00:54

I want to make a sh script that will only run at most once at any point.

Say, if I exec the script then I go to exec the script again, how do I make it so that if the f

6条回答
  •  暖寄归人
    2021-02-08 01:18

    You can use the run-one package, which provides run-one, run-this-one and keep-one-running.

    The package: https://launchpad.net/ubuntu/+source/run-one

    The blog introducing it: http://blog.dustinkirkland.com/2011/02/introducing-run-one-and-run-this-one.html

提交回复
热议问题