I would like to lock a file, run some tests then unlock the file. How can I do this. I could use the command line, perl, or a shell script.
The reason I would like to lock the file is occasionally when connecting with ftp
to our Apache server we get an error upon deleting files: "Cannot open or remove a file containing a running program". I would like to test using an ftp
move command instead of a delete command to see if I catch this error. I would like to test whether locking a file would cause this error.
fcntl()
locks, or the old 0000 permissions lock that people can still be found using today, that other question does not address that at all and this is not a duplicate. Andflock
is not the sole tool for this in any case. – JdeBP Feb 27 '18 at 22:07