Hallo Leute, ich habe ein relativ komplexes System aus Shell-Scripten von FreeBSD nach SuSE-Linux 7.3 zu portieren. Da werden jede Menge Lese- und Schreibvorgänge auf diverse log-Files von verschieden Prozessen durchgeführt. Im FreeBSD gibt es für das file-locking das Programm lockf mit Optionen für Ausführung im Hintergrund und Haltedauer. Unter SuSE Linux gibt es lediglich die C-Funktion flock(), die auch in den man-pages beschrieben ist. Unter BSD ist das file-locking mit lockf relativ simpel mit der shell zu lösen: #!/usr/local/bin/ksh # # usage: $0 [read|write|append] <filename> [<content>] lock="lockf -ks -t 50 $2" # -k Causes the lock file to be kept (not removed) after the com- # mand completes. # # -s Causes lockf to operate silently. Failure to acquire the # lock is indicated only in the exit status. # # -t seconds Specifies a timeout for waiting for the lock. By default, # lockf waits indefinitely to acquire the lock. If a timeout # is specified with this option, lockf will wait at most the # given number of seconds before giving up. A timeout of 0 may # be given, in which case lockf will fail unless it can acquire # the lock immediately. case $1 in (read) $lock cat $2 ;; (write) echo "$3" | $lock tee $2 > /dev/null ;; (append) echo "$3" | $lock tee -a $2 > /dev/null ;; (*) echo fehler exit 1 ;; esac Unter SuSE bedeutet die Situation, ein C-Programm für diesen Fall mit flock () ist zu erstellen. Meine Frage: Hat jemand in der SuSE-Usergemeinschaft schon eine solche Lösung, bevor ich das Rad neu erfinde? Vielen Dank! Lutz l.steinau@emessage.de