I have written a function in our ERP-System which writes a log to a file on the server by simply "echoing" it to the logfile.
echo "SOME LOGDATA" >> /users/erp/log/LOGMSG
Every time a user triggers a specific event, the LOG function is called.
What would happen if 2 users trigger the LOG event exactly at the same time?
Does "echo" take care of file locking? In my opinion it has to be the linux kernel or the bash who has to takes care, that a file is not written by 2 command line instructions simultaneously.
I wrote a testcase to force this condition (some 1000 LOG calls within one second) and it seems that my thoughts are right but I can not be really sure, that these calls are executed at the same time on the bash.