Login Script - log files overwritten

  • Thread starter Thread starter John
  • Start date Start date
J

John

I have a script (cmd file) is being called from the login
script. If a condition is met the computer name is
written to a log file housed on a share. Users have
rights to write to the file but not delete. The problem
is randomly (once or twice a week) the log file is being
overwritten. I have seen happen with different script(s)
and different log files.

An example of the syntax in the script(s) is below:

echo %COMPUTERNAME% >> \\servername\share\logfile

ideas? Two users writing to the file at the same time ?

thanks
 
John said:
I have a script (cmd file) is being called from the login
script. If a condition is met the computer name is
written to a log file housed on a share. Users have
rights to write to the file but not delete. The problem
is randomly (once or twice a week) the log file is being
overwritten. I have seen happen with different script(s)
and different log files.

An example of the syntax in the script(s) is below:

echo %COMPUTERNAME% >> \\servername\share\logfile

ideas? Two users writing to the file at the same time ?

thanks

You are correct: If two users run the script at the same time
then you get a file sharing violation error. To avoid this trap,
code like this:

echo %ComputerName% >> \\ServerName\share\%ComputerName%

You now schedule a task that runs once every night on the server:

@echo off
if not exist \\ServerName\share\collect md \\ServerName\share\collect
for %%a in (\\ServerName\share\*.*) do
type %%a >> \\ServerName\share\collect\collect.txt
del /q \\ServerName\share\collect\*.*
 
Back
Top