Skip to content

Commit

Permalink
Prevent the possible multiple recording instances from starting which…
Browse files Browse the repository at this point in the history
… corrupts recordings.
  • Loading branch information
matteius committed Jan 3, 2025
1 parent cb9561b commit e07ae0c
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions package/prudynt-t/files/record
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,13 @@ touch $RECORD_FLAG
# fi
#fi

LOCK_FILE="/tmp/record.lock"

# Add near start, before the main loop:
if ! mkdir "$LOCK_FILE" 2>/dev/null; then
die "Another instance is already running"
fi
trap 'rm -rf "$LOCK_FILE"' EXIT
required_space=$((120 * record_duration))
min_free_space=$(($(df | grep "$record_mount" | awk '{print $2}') * (100 - record_diskusage) / 100 ))
[ "$min_free_space" -gt "$required_space" ] && required_space=$min_free_space
Expand Down

0 comments on commit e07ae0c

Please sign in to comment.