使用flock保证同一时间只有一个脚本在运行

OPTIONS
       -s, --shared
              Obtain a shared lock, sometimes called a read lock.
读锁
       -x, -e, --exclusive
              Obtain an exclusive lock, sometimes called a write lock.  This is the default.
写锁

       -u, --unlock
              Drop  a  lock.   This  is  usually  not required, since a lock is automatically dropped when the file is
              closed.  However, it may be required in special cases, for example if the  enclosed  command  group  may
              have forked a background process which should not be holding the lock.

       -n, --nb, --nonblock
              Fail (with an exit code of 1) rather than wait if the lock cannot be immediately acquired.
非阻塞

       -w, --wait, --timeout seconds
              Fail (with an exit code of 1) if the lock cannot be acquired within seconds seconds.  Decimal fractional
              values are allowed.
超时时间

       -o, --close
              Close the file descriptor on which the lock is held before executing command.  This is useful if command
              spawns a child process which should not be hold ing the lock.

       -c, --command command

              Pass a single command to the shell with -c.

要执行的命令


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值