background.sh: lock the log file with flock, so as to detect and prevent conflicts.