I have a function that writes to a file, how can I use another script to check if the file is used for writing or is it closed?
Edit: this file can be opened for writing by another script / application / system ...
thank.
You should use flockin both scenarios. This puts the flag in the file so that other scripts are informed that the file is being used. The flag is turned off either intentionally, using fclose, or implicitly at the end of the script.
flock
fclose
Unix, lsof ( "LiSt Open Files" ). "FD" , , .
, ", X , -..." . , , .
I would say just use the file open function, if it returns false then the file is obviously still open.
Source: https://habr.com/ru/post/1784385/More articles:https://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1784380/intent-to-send-an-sms-to-multiple-contactcs&usg=ALkJrhg1RxRBgwhePsMB0buTtzKXvEabGAtools: memory leak when creating UIButton - memory-leaksHow to configure WebView to allow getImageData on canvas from local or remote files? - javascriptGet current system volume in Windows 7 - c #The output is displayed in the console, but disappears when redirected to a file - windowsIs there a way in Java (+ - JNA) to establish a reliable master system level in XP + Vista + Windows 7? - javaICMP Host-Unreachable - cIncorrect syntax near comma - sqlWhat is the difference between "xxx-compliant" and "xxx-compatible"? - terminologyuse sheet in excel user-defined function - vbaAll Articles