> >So you're querying a 'users logged in table' and if the current user
> >goes to log off, and they're the only person in that table, then a
> >backup happens?

> Actually, I log the last user off first, so the goal is 0 rather than 1
> record, but yes.

How about a simple approach of a control file? In your logic, define a
location of a file, say "copyingfiles.txt", and if it is there, it
means another workstation is copying the files. So, when you log off,
do something like this:

IF NOT FILE("\\server\share\copyingfiles.txt") Then
  STRTOFILE("hi", "\\server\share\copyingfiles.txt")
  CopyFiles()
  DELETE FILE "\\server\share\copyingfiles.txt"
ENDIF


Note that I also do a simple LockFile() on the file to make sure the
other workstation didn't squeeze inbetween the first two lines.

LOCAL lhLockFile
lhLockFile = CreateFile(tcFile, 0x40000000, 0, 0, 2, 0x00000080, 0)
IF -1 != lhLockFile Then
  IF 0 != LockFile(lhLockFile, 0, 0, 0xFFFF, 0) Then
    * Locked
    * do your stuff

    UnlockFile(lhLockFile, 0, 0, 0xFFFF, 0)
    CloseHandle(lhLockFile)
  ENDIF
ENDIF


Before it runs, define the win32 functions:

                DECLARE Integer CreateFile IN WIN32API ;
                        String lpFileName, ;
                        Integer dwDesiredAccess, ;
                        Integer dwShareMode, ;
                        Integer lpSecurityAttributes, ;
                        Integer dwCreationDisposition, ;
                        Integer dwFlagsAndAttributes, ;
                        Integer hTemplateFile

                DECLARE Integer CloseHandle IN WIN32API ;
                        Integer hObject
                        
                DECLARE Integer LockFile IN WIN32API ;
                        Integer hFile, ;
                        Integer dwFileOffsetLow, ;
                        Integer dwFileOffsetHigh, ;
                        Integer dwNumberOfBytesToLockLow, ;
                        Integer dwNumberOfBytesToLockHigh
                
                DECLARE Integer UnlockFile IN WIN32API ;
                        Integer hFile, ;
                        Integer dwFileOffsetLow, ;
                        Integer dwFileOffsetHigh, ;
                        Integer dwNumberOfBytesToLockLow, ;
                        Integer dwNumberOfBytesToLockHigh




-- 
Derek


_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/[EMAIL PROTECTED]
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to