Is it possible to know whether my system is running on mains or battery(ups) so that system automatically shuts down after giving a message.
My ups is not having usb support.
does'nt your UPS makes any beeps,the beep sounds indicates(while switching on and during power cut)wheather it is running on mains or battery.
there are two types of UPS.. online and offline.
if your UPS is not connected to the computer using USB or serial, then its an offline UPS. sorry there is no way for your computer to detect if its running on power or UPS.. i am not sure though.. they may be another way.
munim2020 , iam sorry to say that your answer is so wrong!!!!!!!!! .
ONLINE UPS : online ups means it will always runs on battery , it never link ac directly to the pc ,at the same time it use ac to charge its battery
OFFLINE UPS : thats the ups that we use in our home and for normal desktop use .These ups are line intractive ups that it draw power directly from ac and it regulates it then its supplys to computer .In the event of power failure it goes to battery mode