脚本中是否有互斥量

脚本中是否有互斥量

本文介绍了shell 脚本中是否有互斥量/信号量机制?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找 shell 脚本中的互斥量/信号量/并发机制.考虑以下情况:除非a"用户不关闭共享文件,b"用户不应该能够打开/更新它.我只是想知道如何在 shell 脚本中实现互斥、信号量、临界区等.

I'm looking for mutex/semaphore/concurrency mechanism in shell script.Consider following situation:Unless "a" user does not close the shared file, "b" user should not able to open/update it.I'm just wondering how to implement mutex, semaphore, critical sections, etc. in shell scripting.

在shell脚本中实现锁定机制[文件级]最简单的方法是什么?

Which is the easiest way to implement locking mechanism [file level] in shell scripting?

推荐答案

参见 BashFAQProcessManagment 用于讨论 Bash 中的文件锁定.

See BashFAQ and ProcessManagment for discussions on file locking in Bash.

将您的问题标记为 shell(仅)会限制可以帮助您的人数.您可能想要添加 unix、ksh、bash.

Tagging your question as shell (only) limits the number of people that can help you. You may want to add unix, ksh, bash.

已经在 S.O 上发布了许多关于此主题的问题/答案.

There are numerous questions/answers on this topic posted here already on S.O.

我希望这会有所帮助.

这篇关于shell 脚本中是否有互斥量/信号量机制?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-23 07:43