Computer shutting off after a few seconds to a few minutes
This sounds like an auto shut-off signal given by the processor because of a possible over-heating issue. This usually happens when the laptop has been run for an extended time without having the dust, dirt and debris cleaned from its cooling vents and grills. After time, the thermal paste on the processor bakes under the extreme heat and starts to flake off and lose its efficiency at cooling the processor.
Get a few cans of compressed air that you would buy at an office supply store and using short bursts, blow out the dust and dirt from all the ventilation grills and vents first, make sure the laptop is powered down and battery removed. Then, open all the compartments and clean them out as well including the cd/dvd tray. There is a small black hole on the dvd bezel, just stick an open paperclip in it and it will pop the tray open. Blow a good blast in there to clean the dvd player.
There is the possibility that the thermal paste will have to be replaced, that means you need to gain access to the heatsink and remove from the processor, clean all the old thermal paste from it and apply a small thin layer of new paste to the top of the processor and replace the heatsink, securing it evenly with the attached screws. Below is the link to the service manual that should help....