3 [ "$include_session_lock" ] && return 0
4 include_session_lock="$0"
8 local timeout="${2-900}"
9 local lockdir="$_DATA/lock/${file#$_DATA}"; lockdir="${lockdir%/}"
10 local ovlock="${lockdir%/*}/delete.${lockdir##*/}"
11 local tempfile="$lockdir/${SESSION_ID}"
12 local lockexpire=$(( $(date +%s) - timeout ))
14 mkdir -p "$_DATA/lock/${file%/*}"
16 if [ -e "$lockdir" ] \
17 && [ "$(stat -c %Y "$lockdir")" -lt "$lockexpire" ] \
18 && mkdir "$ovlock"; then
19 [ "$(stat -c %Y "$lockdir")" -lt "$lockexpire" ] \
24 printf '%s\n' "$tempfile"
25 if mkdir "$lockdir" 2>&-; then
26 cp "$file" "$tempfile"
35 local lockdir="$_DATA/lock/${file#$_DATA}"; lockdir="${lockdir%/}"
36 local tempfile="$lockdir/${SESSION_ID}"
38 printf '%s\n' "$tempfile"
39 if [ -f "$tempfile" ]; then
49 local lockdir="$_DATA/lock/${file#$_DATA}"; lockdir="${lockdir%/}"
50 local ovlock="${lockdir%/*}/delete.${lockdir##*/}"
51 local tempfile="$lockdir/${SESSION_ID}"
53 if [ -f "$tempfile" ] && mkdir "$ovlock"; then
54 [ -f "$tempfile" ] && rm -r "$lockdir"