Main Menu

Search

LINUX: HOW TO CHECK FILE LOCKING IS WORKING IN A DIRECTORY, FILE SYSTEM IN LINUX

Following command can be used to check if file locking is working in a particular directory in Linux. Replace /tmp with the directory name as needed where you have to create test-lockfile. Below command will clean the test-lockfile as well once the test is done.

cd /tmp;flock test-lockfile -c 'echo Success :::: File lock acquired';\rm /tmp/test-lockfile

Sample Output.

Success :::: File lock acquired

If the test is unsuccessful you will see Permission denied errors.


Products to which Article Applies

All Linux Operating Systems 

Search Keywords: linux lock lockfile file locking share nfs directory directories filesystem system how to check checking

Article Author: Tarun Boyella

 

No comments:

Post a Comment