±ÜÃâCRONTABͬʱִÐжà¸ö½Å±¾µÄ·½·¨--ÎļþËø
freebsdÏÂÃ棺
Ò»¸öºÃÓõķ½·¨ÊÇÀûÓÃlockf(freebsdÏÂΪlockf£¬linuxÏÂΪflock)£¬Ôڽű¾Ö´ÐÐÇ°ÐèÒª¼ì²âÄÜ·ñ»ñȡij¸öÎļþËø£¬·ÀÖ¹½Å±¾ÔËÐгåÍ»¡£lockf µÄ²ÎÊýÈçÏ£º
-k£º Ò»Ö±µÈ´ý»ñÈ¡ÎļþËø-s£ºsilent£¬²»·¢³öÈκÎÐÅÏ¢£¬¼´Ê¹Äò»µ½ÎļþËø-t seconds£ºÉ趨timeoutµÄʱ¼äÊÇsecondsÃ룬Èç¹û³¬¹ýʱ¼ä£¬Ôò×Ô¶¯·ÅÆú¡£
for example£º
ÒÔϽű¾Ö´ÐÐÇ°£¬Ðè»ñÈ¡ÁÙʱÎļþcreate.lock µÄÎļþËø
*/10 * * * * ( lockf -s -t 0 /tmp/create.lock /usr/bin/python /home/project/cron/create_tab.py >> /home/project/logs/create.log 2>&1)
linuxÏÂÃ棺
flock¡£ÎÒ´Ó×ÖÃæÉϲ²âÊÇÎļþÃèÊö·ûËø~~helpÏÔʾÈçÏ£ºflock (util-linux 2.13-pre7)
Usage: flock [-sxun][-w #] fd#
flock [-sxon][-w #] file [-c] command...
-s --shared Get a shared lock
-x --exclusive Get an exclusive lock
-u --unlock Remove a lock
-n --nonblock Fail rather than wait
-w --timeout Wait for a limited amount of time
-o --close Close file descriptor before running command
-c --command Run a single command string through the shell
-h --help Display this text
-V --version Display version
±ÈÈçÔÚrsync¶¨Ê±Í¬²½Ä³Îļþ¼ÐµÄʱºò£¬¿ÉÄܵ£ÐÄÉÏÒ»´ÎÈÎÎñ»¹Ã»Ö´ÐÐÍ꣬ÏÂÒ»´Î¾Í¿ªÊ¼ÁË¡£ÓÚÊÇ¿ÉÒÔ²ÉÓÃÈçÏ·½Ê½£º1 * * * * flock -xn /var/run/rsync.lock -c 'rsync -avlR /data/files 172.16.xxx.xxx:/data¡¯
¶ÔÕÕusage£¬x´´½¨Ò»¸ö¶ÀÏíËø£¬nÊÇÈç¹ûÒÑ´æÔÚ¾ÍÍ˳ö£¬È»ºóÒ»¸ölockÎļþ£¬cÊÇshellÃüÁ¾ßÌåÄÚÈݾÍÊÇrsync¡£
ÍƼöÐÅÏ¢
- linuxÃüÁîѧϰ±Ê¼Ç£¨11£©£ºnlÃüÁî
- linuxÃüÁîѧϰ±Ê¼Ç£¨5£©£ºrmÃüÁî
- linuxÃüÁîѧϰ±Ê¼Ç£¨4£©£ºmkdirÃüÁî
- linuxÃüÁîѧϰ±Ê¼Ç£¨1£©£ºlsÃüÁî
- ½«CentosµÄyumÔ´¸ü»»Îª¹úÄڵİ¢ÀïÔÆÔ´
- ʹÓÃNginxÌí¼Óheader·ÀÖ¹ÍøÒ³±»frame
- linuxϼÓËÙscp´«Êä´óÎļþµÄËÙ¶È
- linuxϵͳÉ϶ÔnginxÈÕÖ¾·Ö¸î´¦Àí
- lnmp/nginxϵͳÕæÕýÓÐЧµÄͼƬ·ÀµÁÁ´ÍêÕûÉèÖÃÏê½â
- Í»ÆÆÊ®Íò²¢·¢µÄNginxµÄÅäÖü°ÓÅ»¯
ÈÈÃÅÐÅÏ¢
- nohup: redirecting stderr to stdou....
- ʹÓÃlog_formatΪNginx·þÎñÆ÷ÉèÖøüÏêϸµÄÈÕÖ¾¸ñʽ
- jquery easyUI--dataGrid-Json
- [Ô´´]·ÂGoogle Reader¡¢ÐÂÀË΢²©¡¢ÌÚѶ΢²©µ....
- ÀûÓÃKeepalived+mysql¹¹½¨¸ß¿ÉÓÃMySQLË«Ö÷×Ô¶....
- Nginx+keepalivedʵÏÖ¸ºÔؾùºâºÍË«»úÈȱ¸¸ß¿ÉÓÃ
- jqueryʵÏÖÒ³Ãæ¼ÓÔؽø¶ÈÌõ
- Rolling cURL: PHP²¢·¢×î¼Ñʵ¼ù
- codeigniter ·ÓÉÖÕ¼«ÓÅ»¯(url rewrite)
- linuxÏÂÉèÖÃsshÎÞÃÜÂëµÇ¼
×î½ü¸üÐÂ
- ²éÕÒ²¢É¾³ý.svnĿ¼Îļþ
- redis ÆßÖÖÊý¾ÝÀàÐ͵ÄʹÓó¡¾°
- linux ÏÂÎļþ¸´ÖƵ½windowsÏÂÂÒÂëµÄ½â¾ö°ì·¨
- nginx³öÏÖ502 upstream sent too big he....
- linuxÏÂsudoÅäÖÃÏê½â
- linuxÃüÁîѧϰ±Ê¼Ç£¨15£©£ºtailÃüÁî
- linuxÃüÁîѧϰ±Ê¼Ç£¨14£©£ºheadÃüÁî
- linuxÃüÁîѧϰ±Ê¼Ç£¨13£©£ºlessÃüÁî
- linuxÃüÁîѧϰ±Ê¼Ç£¨12£©£ºmoreÃüÁî
- ¼ÓÃÜËã·¨±È½Ï3DES AES RSA ECC MD5 SHA1µÈ
ÆÀÂÛ