diff --git a/package/prudynt-t/files/record b/package/prudynt-t/files/record index d04b4672c..a4978488f 100755 --- a/package/prudynt-t/files/record +++ b/package/prudynt-t/files/record @@ -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