ENLOCK

Description

Lock or unlock a script for a duration time.

Command

enlock -s <scriptname> [-c (lock|unlock|trylock)] [-d <timeout>] [-p <pid>]
-s <scriptname> : used to deduce the name of the lock
-c <action> :
	-c lock : wait for the lock to be available and take it
	-c unlock : release the lock
	-c trylock : try to take the lock, but abort immediatly if it's held by another process
-c : Default action = lock
-d <timeout> : maximum time to wait to get the lock
Only valid for '-c lock' and between 0 and 300
-1 = forever (default)
-p <caller pid> : pid written in the lock file (by default, getppid())

Example