Force Client Quit before backup

Chip Scheide (7/18/08 1:09PM)


Chip Scheide (7/18/08 1:09 PM)

I have a stored procedure which is supposed to run about 10 minutes

before a backup occurs

this routine is designed to contact all the connected users and call

the "quit" routines

It seems that this works fine if the client is NOT inside a
transaction

(part of the reason for the forced exit to start with), but fails to

disconnect the client if they are in a transaction.

Ideas to get 4D Clients to quit?

notes:

1 - YES I am willing to throw away anything the user did in the

transaction that is open - as the user will NOT have been at their
desk

for hours when this code runs.

2 - Clients all are automatically registered

3 - 4D 2003 C/S OSX and Windows

4 - not every process knows about (looks at or respects) <>ff_Quit,

primarily only deamons look at this variable

5 - Code of quit routine (run on Client):

   `(m)  menuf_Quit_4D

 `insure that all processes have an oprotunity to exit correctly

 `â&Auml;¢ Created 7/15/02 cs

C_LONGINT($i)

â&oacute;&auml;f_Quit:=True  `flag for Deamons - time to take a break :)

For ($i;1;Count tasks)  `for every process (primarily for deamons) -

wake it

RESUME PROCESS($i)

CALL PROCESS($i)

End for

QUIT 4D  `exit 4D client

 `

6 - code of stored procedure (running on server) :

 ``(m) deamon_Boot_User_4_Backup

 `deamon process running on server - designed to boot user before

backup

 `avoids the issue of open transactions during a backup attempt

 `â&Auml;¢ Created 4-07-08 by Chip

C_LONGINT($Current_time;$Backup_Time;$Allowed_Difference;$Time_Till_Backup
)

ARRAY TEXT($Clients;0)  `arrays for registered clients

ARRAY LONGINT($Methods;0)

Repeat

dialog_Get_Preference_Record



$Current_Time:=Current time(*)*1  `current time as a long
int

$Backup_Time:=[Dialogs]Backup_Time*1  `time the backup is to
occur as

long int

$Allowed_Difference:*60  `allowed "fudge factor" so that
if this

process wakes up with-in this time period of a back up users can be

booted



If ($Current_Time>=($Backup_Time-$Allowed_Difference)) &

($Current_Time<<=$Backup_Time)  `process woke up insie allowed time

period of backup

GET REGISTERED CLIENTS($Clients;$Methods)  `get list
of all clients

currently attached to the server



For ($i;1;Size of array($Clients))  `for each client

EXECUTE ON CLIENT($Clients{$i};"menuf_Quit_4D")
 `force the
executio

of the quit routine

End for

ARRAY TEXT($Clients;0)  `cleanup

ARRAY LONGINT($Methods;0)

DELAY PROCESS(Current process;MAXINT )  `put this
method back to

sleep `maxint = about 9 hours

Else   `else woke up outisde of allowed time period befor a
backup

$Time_Till_Backup:=$Backup_Time-$Current_Time
 `determine how long

until the next backup



If ($Time_Till_Backup>MAXINT )  `if backup is to occur
in << about 9

hours

DELAY PROCESS(Current process;MAXINT )  `delay
for maxint = about 9

hours

Else   `delay until just backup time

DELAY PROCESS(Current

process;$Time_Till_Backup-($Allowed_Difference/2))

End if

End if

Until (â&oacute;&auml;f_Quit)

 `

Reply to this message

Summary created 7/18/08 at 6:04PM by Intellex Corporation

Comments welcome at: feedback@intellexcorp.com