有没有在shell脚本任何互斥/信号量机制? [英] Is there any mutex/semaphore mechanism in shell scripts?

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

问题描述

我在寻找互斥 / 信号灯 / 并发机制 shell脚本
请考虑以下情况:
除非用户不会关闭共享文件,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 mechanism in shell scripting.

还有一个问题:
这是落实 shell脚本锁定机制 [文件级]最简单的方式

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

推荐答案

请参见 BashFAQ 和<一个href=\"http://mywiki.wooledge.org/ProcessManagement#How_do_I_make_sure_only_one_copy_of_my_script_can_run_at_a_time.3F\">ProcessManagment在巴什在文件锁定的讨论。

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

标记你的问题为壳(只)限制的人,可以帮助你的号码。您可能需要添加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脚本任何互斥/信号量机制?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆