Re: Login Script - log files overwritten

From: Pegasus \(MVP\) (I.can_at_fly.com)
Date: 03/01/04


Date: Tue, 2 Mar 2004 07:44:39 +1100


"John" <anonymous@discussion.microsoft.com> wrote in message
news:495601c3ff93$7fd88ec0$a401280a@phx.gbl...
> 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\*.*



Relevant Pages

  • Re: Need help: perl script to FTP
    ... > On the game server is log file which contains all of the data from the ... > on my webserver, which is supposed to login to the gameserver and download ... The &sendsubroutine doesn't exist in your script. ...
    (perl.beginners)
  • Re: Need help: perl script to FTP
    ... > On the game server is log file which contains all of the data from the ... > on my webserver, which is supposed to login to the gameserver and download ... The &sendsubroutine doesn't exist in your script. ...
    (comp.lang.perl)
  • Re: unix shell script ignores exit when in function that is piped to tee
    ... > I thought calling a function within a script did NOT create sub-shells. ... is going to be able to alter the log file to cover up any inappropriate ... entry in the log to the previous entry. ... The easiest way to use crypt to ...
    (comp.unix.shell)
  • The necessity of Setting Objects to Nothing
    ... But what happens when you've got a script that is running as ... Dim Servers, List, strComputer ... Set Folder = objFSO.GetFolder ... '~~~ Write the results of the number of users query to a log file. ...
    (microsoft.public.scripting.vbscript)
  • Re: CSVDE Importing
    ... > specify the log file path via the -j option. ... CSVDE imports can only be used to create new users ... Unfortunately, the syntax is a bit more involved than a simple csv file, ... which makes it a little more difficult to manage its content via script. ...
    (microsoft.public.windows.server.scripting)

Loading