亚洲av成人无遮挡网站在线观看,少妇性bbb搡bbb爽爽爽,亚洲av日韩精品久久久久久,兔费看少妇性l交大片免费,无码少妇一区二区三区

  免費(fèi)注冊(cè) 查看新帖 |

Chinaunix

  平臺(tái) 論壇 博客 文庫
最近訪問板塊 發(fā)新帖
查看: 1993 | 回復(fù): 6
打印 上一主題 下一主題

如何在命令行下讓一個(gè)腳本同時(shí)只有一個(gè)在執(zhí)行? [復(fù)制鏈接]

論壇徽章:
0
跳轉(zhuǎn)到指定樓層
1 [收藏(0)] [報(bào)告]
發(fā)表于 2007-07-06 14:32 |只看該作者 |倒序?yàn)g覽
本問題取消。

[ 本帖最后由 lushy 于 2007-7-6 15:57 編輯 ]

論壇徽章:
0
2 [報(bào)告]
發(fā)表于 2007-07-06 19:47 |只看該作者
我也很想知道這個(gè)

論壇徽章:
0
3 [報(bào)告]
發(fā)表于 2007-07-09 12:20 |只看該作者
幫頂

論壇徽章:
0
4 [報(bào)告]
發(fā)表于 2007-07-09 12:43 |只看該作者
幫頂?shù)耐,看看以前的精華貼,有過非常深入的討論。

論壇徽章:
0
5 [報(bào)告]
發(fā)表于 2007-07-09 15:15 |只看該作者
apue里面的精靈進(jìn)程,有些系統(tǒng)調(diào)用,在運(yùn)行的時(shí)候來鎖住一個(gè)文件,書上有代碼的。

論壇徽章:
0
6 [報(bào)告]
發(fā)表于 2007-07-09 21:45 |只看該作者
沒找到,希望知道答案的能告訴下小弟,謝謝了

論壇徽章:
0
7 [報(bào)告]
發(fā)表于 2007-07-09 21:59 |只看該作者
8. How do I create a lock file?

   Very carefully

   The scheduler can stop one process in the middle of a non-atomic
   operation, and run another one, which wants to perform the same
   operation. The second one, having a full timeslice, might finish
   the operation. When control returns to the first process, confusion
   will reign.

   The trick is to do something atomic, so that this won't
   happen. There are a couple ways to do this. One is to create a
   directory instead of a file, the other is to create a symbolic
   link. Both operations are defined to be atomic by POSIX/SUS, by
   virtue of the fact that they both require invocation of the
   corresponding system calls, which are atomic.

   Beware of trying to create ANY kind of lock file on an NFS
   partition. NFS pretty much eliminates anything like atomicity.  If
   you're going to create a lock file, make sure you're doing it on a
   local partition, such as /tmp.

   Netscape/Mozilla uses the symbolic link method for its lockfile (in
   spite of the fact that it creates it in the user's home directory,
   which may be NFS mounted). When it starts up it creates a file
   named for the IP address of the machine it's running on, and the
   pid of the creating process. Then it tries to create a symbolic
   link named "lock", which points to that file. If this symlink
   already exists, link(2) will return an error. In a script this
   would work something like

   touch /tmp/xxx
   ln -s /tmp/xxx /tmp/lockfile 2>/dev/null
   ret=$?
   rm /tmp/xxx
   if [ $ret -ne 0 ];then
     echo lockfile already exists
     exit 1
   else
     echo success
   fi

   If you have procmail installed, another possibility is the
   lockfile(1) command that comes with it.
您需要登錄后才可以回帖 登錄 | 注冊(cè)

本版積分規(guī)則 發(fā)表回復(fù)

  

北京盛拓優(yōu)訊信息技術(shù)有限公司. 版權(quán)所有 京ICP備16024965號(hào)-6 北京市公安局海淀分局網(wǎng)監(jiān)中心備案編號(hào):11010802020122 niuxiaotong@pcpop.com 17352615567
未成年舉報(bào)專區(qū)
中國互聯(lián)網(wǎng)協(xié)會(huì)會(huì)員  聯(lián)系我們:huangweiwei@itpub.net
感謝所有關(guān)心和支持過ChinaUnix的朋友們 轉(zhuǎn)載本站內(nèi)容請(qǐng)注明原作者名及出處

清除 Cookies - ChinaUnix - Archiver - WAP - TOP