If your ps3 console shuts down and powers itself off after 5 seconds automatically, it then beeps 3 times and the power indicate lighter blinks a red color, it could be because the console is overheating. The internal components that are inside the ps3 console can overheat, if there is a lack of air ventilation around the ps3 console. This can be caused by placing your console in a position that doesn't allow the air vents on the sides of the console to let out the hot air out from the console. It can also be caused because there is too much dust blocking up the air vents, preventing hot air to escape out from the ps3 console. So the ps3 automatically turns itself off to protect the GPU and CPU from overheating and getting damaged.
To resolve this problem with your ps3 console, you will need to clean the air vents and the remove all the dust that is internally inside the console. If you ps3 is still under warranty, use a hoover to suck up the dust in the air vents, as it is not really worth opening up the ps3 console. If you ps3 is purchased second hand and has no official warranty remaining on it, then you can go ahead and dissemble your ps3 console.
Video tutorial for dissembling a ps3 fat:
Video tutorial for dissembling a ps3 slim:
Once you have dissembled your ps3 console, using a can of compress air blow out or use a hoover to remove the dust from the inside of the ps3 console. Make sure you clean up the cooling fan and clean all air vents that are placed on the console. Once you have completed the cleaning process, the ps3 components can now dispatch heat much more freely and your ps3 will remove its protection.