Page 1 of 1 1
Topic Options
#145800 - 2005-08-17 02:35 AM File locks
cyri Offline
Getting the hang of it

Registered: 2005-06-27
Posts: 95
Maybe I'm beating a dead horse here. I know there has been lots of posts on this subject, but I don't remember seeing anyone ask this.

Is there a way for kix to identify if a file is locked and then loop a procedure until it isn't locked? Or is there no way for kix to know the difference between a file lock and for example, a read only file? Like with @ERROR or something?

Seems like such a basic thing to do, but yet so hard to accomplish. Perhaps there are programs out there that create copies of the file when accessed at the same time and then merge them together when the file is no longer locked.

I have an issue where this main file needs to be as up to date as possible. The main script is running as part of the login script. Creating a log file for each computer and then merging them as part of an admin script is just not feasible.

Any ideas?

Top
#145801 - 2005-08-17 03:29 AM Re: File locks
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11634
Loc: Space
Sure, you could loop an open file for write check until it no longer errors I suppose. But really think you're overlooking an easy thing by having each compute log their own file.

Then COPY *.LOG BIGFILE.TXT is a piece of cake. Not sure why you think it is so unfeasable.

Top
#145802 - 2005-08-17 08:16 PM Re: File locks
cyri Offline
Getting the hang of it

Registered: 2005-06-27
Posts: 95
I don't know. I guess I'm just slow or something. The main problem I have with doing seperate files for each is the merging process back into the master text file. It would need to be done manually with an admin script? I don't know how else you could automate this part. Cheap way would be setting up the merge script as a scheduled task on one of the servers I guess.

I'm looking for something fully automated. The master text file needs to be updated at least a few times a day.

Top
#145803 - 2005-08-17 08:48 PM Re: File locks
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11634
Loc: Space
Well that is rather easy to do as well


Break On
Dim $SO
$SO=SetOption('Explicit','On')
$SO=SetOption('NoVarsInStrings','On')

SHELL '%COMSPEC% /e:1024 /c COPY C:\LOGS\*.LOG C:\LOGS\Master.txt ' + '>nul 2>nul'
DEL 'C:\LOGS\*.LOG'

Top
#145804 - 2005-08-17 10:54 PM Re: File locks
cyri Offline
Getting the hang of it

Registered: 2005-06-27
Posts: 95
Still a possibility of file lock issues when merging though. A computer could be running the login script and writing to it's @wksta+".log" file when it's trying to merge to the master text file. Do you think that would be a problem?
Top
#145805 - 2005-08-17 11:01 PM Re: File locks
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
Just schedule the merge script to run at night. Hope nobody is logging in then besides from logging into his/her bed.
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#145806 - 2005-08-17 11:12 PM Re: File locks
cyri Offline
Getting the hang of it

Registered: 2005-06-27
Posts: 95
We have people logging in 24 x 7 unfortunatelly. Makes things a pain to get done during the week. That's why I want this to run during login script.

I think I can make this work the way NTDOC is suggesting.

What I can do to get around the file lock issue when merging to the master file is have the script keep track of the log files that fail to merge and then continue to try until the master file is not locked.

Though, if I go through all that trouble why not just have it do that in the login script in the first place. I feel like I'm chasing my tail here.

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 847 anonymous users online.
Newest Members
fgarcia, Viginette, ManuvdWielNL, Sir_Barrington, batdk82
17889 Registered Users

Generated in 0.055 seconds in which 0.023 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org