Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Running automated jobs
Message
From
24/09/2002 08:19:10
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00703703
Message ID:
00703708
Views:
16
>Hi,
>
>We have a program that runs every night, and it updates a database on the server with new data. And during this time, the application requires exclusive rights to the database. Many times it has happened that, when the job kicks off at the pre-set time, it finds that there is a user accessing the database and since the application cannot open the database exclusively, it aborts with an error message.
>
>I believe that most often, the users might have another application that accesses this database running, while the night job is trying to start. I am trying to see how we can resolve this.
>
>- Can I send a message to the users asking them to close the other application ?
>- If the other application is running unattended, can I forcefully make the user exit from that application?
>
>I would really appreciate it, if you could suggest other ways to resolve this.
>
>Thanks in advance.
>
>Ria

Create a file on your server with a reserved name - for instance, "maintenance.mark".

In your applications, have a timer that checks every few minutes for this file:
Timer.Timer()
if file("maintenance.mark")
  goApplication.OnQuit()
endif
Also, check for this file on startup, and quit immediately if the file is found (show appropriate messages in both cases - for instance, with WAIT WINDOW ... TIMEOUT).

In the example above, I am assuming you have an application object called goApplication, and that this has a method called OnQuit() that quits the application. Replace whatever is relevant for your particular application.

In the maintenance task, create this file. Don't forget to delete it after you finish.

HTH, Hilmar.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Previous
Reply
Map
View

Click here to load this message in the networking platform