aboutsummaryrefslogtreecommitdiff
path: root/lock
blob: b0ba75f4b8450a61435ef34bf21f4970822ee0d3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
lock() {

	if ! mkdir "$1" &>/dev/null;  then
		while true; do
			sleep 2;
			if [[ ! -d "$1" ]]; then
				return
			fi
		done
	fi;

}

if [[ "$#" -eq "1" ]]; then
	lock $1
else
	echo "please supply one argument: the lock folder"
	exit 1
fi