I want to make a sh script that will only run at most once at any point.
Say, if I exec the script then I go to exec the script again, how do I make it so that if the f
( if flock -n 9 then echo 'Not doing the critical operation (lock present).' exit; fi # critical section goes here ) 9>'/run/lock/some_lock_file' rm -f '/run/lock/some_lock_file'
From example in flock(1) man page. Very practical for using in shell scripts.