Well its not a software problem...
may be ur Switch of power is not working properly
or their is some problem with your motherboard.
u can try out two things:
first check the motherboard for any swelled Capacitors...as with time the capicators get swelled and creates problem in proper working...keeping those old capacitors can be harmfull as in case they may burst. get those capacitors changed if their is any swelled ones.
second thing disconnect the SMPS power cord from the motherboard and try to short circuit the two green wires into it...bu doing so, if the fan os SMPS is running then their is no problem in power supply.
Becautious while doing both the things.
Enjoy!