|
-
Aug 6th, 2003, 09:23 PM
#1
Thread Starter
Hyperactive Member
UPS make my program get a problem.
I use some computer that connect to UPS. Some time when electric problem occurs it will make UPS work. OK that UPS can make a backup electrical for my PC but sometime like the time that UPS is low battery it will try to shutdown my PC before battery is empty. That is a problem , it shutdown in a time that my program still running. It's make my program get some problem and relate to database (I mean my database will not be used after this problem). So I think if UPS can shutdown my PC, it maybe use the way that send some command to my PC to shutdown. However that is my problem that I don't know more than this. My I ask you like this.
1. How that UPS connect to PC? (I see some communication line on this case but I don't know more.)
2. How can I try to break the shutdown process and save all of my data and then shutdhown it with my program? (Sure that my program is developed by VB.)
All of this solution for make sure that it's a good result for my computer and for my program (shutdown befor no electrical but shutdown after all data is save).
I will try to look this post in most time for discuss everything with you.
-
Aug 6th, 2003, 09:33 PM
#2
UPS dosn't send any command that I'm aware of. It is there
to maintain power to the PC in the event of mains power failure.
If the battery in the UPS is low, then there is a problem with the UPS.
Bruce.
-
Aug 6th, 2003, 09:42 PM
#3
Thread Starter
Hyperactive Member
I understand your opinion but this something I want to tell you.
1. I think it about Model of UPS. Some model is used for electrical support only but some model have a communication port or LAN that use for connect to PC that do something.
2. At least 2 things that I see UPS can do. One is send UPS status to PC for showing in monitor. Other one is shutdown computer. I havebeen see the shutdown process with UPS.
-
Aug 6th, 2003, 10:10 PM
#4
Actually most UPS's connect to a machine via a serial cable. When the power goes out, or there is a surge, a message is sent via the cable to the computer. It is determined how long the computer can survive on the UPS and it will usually initiate a shutdown sequence in order to save data.
The way I see it Solar there are two things you can try, the first is hard and the second is fairly simple:
1. What you can try and do Solar is listen to the com port via your program. You will probably have to do some trial and error to see what commands you get from the UPS device.
2. You can use the QueryUnload event to see if it is a system shutdown causing your program to quit:
Code:
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
' System is shutting down
If UnloadMode >= 2 Then
'Do whatever you need to do to save your DB.
End If
End Sub
-
Aug 6th, 2003, 10:18 PM
#5
Thread Starter
Hyperactive Member
May I ask you more from your suggestion one by one.
1. "listen to the com port ". Can you explain me more that how? May you give me some code.
2. "Form_QueryUnload". You mean that all thing I try in this Sub will be done if computer try to shutdown, Right? And after all process in this sub done so computer will be continue shutdhown, Right? And computer will be not shut down if all command in this Sub is not finished, Right?
-
Aug 6th, 2003, 11:22 PM
#6
Originally posted by Bruce Fox
UPS dosn't send any command that I'm aware of.
My appologies solar115, I have since learned that they do connect to the PC (as Negative0 has also mentioned).
Bruce.
-
Aug 7th, 2003, 04:24 AM
#7
Originally posted by solar115
[B]May I ask you more from your suggestion one by one.
1. "listen to the com port ". Can you explain me more that how? May you give me some code.
this is a nightmare to work with - don't even try it.
2. "Form_QueryUnload". You mean that all thing I try in this Sub will be done if computer try to shutdown, Right? And after all process in this sub done so computer will be continue shutdhown, Right? And computer will be not shut down if all command in this Sub is not finished, Right?
Basically yes, but the computer will only give your program a certain amount of time to finish.
I think the default is 10 to 15 seconds, but this can be changed on the pc (I can't remember how).
-
Aug 7th, 2003, 08:01 AM
#8
Hyperactive Member
Do you want the UPS to control your PC?
I have a UPS, but I never installed the s/w that came with it or the serial cable to the PC.
It's used ONLY for the batteries and whatever line filtering it provides.
This PC essentially never runs unattended, i.e. it's not a blackbox server running in a closet somewhere, so when the power goes out someone knows and hears the UPS beeping so a controlled, manual shutdown can be done.
So, if you don't want the s/w overhead, or questions about any strange program interactions or undesired "HAL" type control of your PC, then uninstall any software that came with the UPS and disconnect the control cable. (just my opinion)
Have fun, DaveBo
"The wise man doesn't know all the answers, but he knows where to find them."
VBForums is one place, but for the really important stuff ... here's a clue 1Tim3:15
-
Aug 7th, 2003, 08:41 PM
#9
Thread Starter
Hyperactive Member
DaveBo, I think your opinion is OK but may not match with my concept. Cause that my project is something like ATM (but my project is not relate to money ). That it still running without somebody to monitor it. If user come to use in a time that it shutdown by UPS the error is effect to user too (and some data in my program will be error.)
-
Aug 10th, 2003, 10:24 PM
#10
solar115
The whole point of the UPS and the UPS software is to keep your computer running long enough for you to shut it down gracefully before it has to do it forcablily.
If the electricity goes off. It is only a matter of time before the computer will stop running anyway. It is up to the program to know this. The OS (if equiped) will notify the programs by attempting to shut them down.
This is your programs responsibility at this time to exit gracefully. If not it will be shut down soon anyway. Either abuptly by having no power or gently by issuing a shutdown command to all programs and the program saving their data and run states.
You only have two options... I suggest your program should shut itself down to avoid data corruption possibilities.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|