Answers (1)
By turn off, do you mean shut down? Log out?
For both cases, I'd advise this, going from the first step, to the last:
Please note that Yosemite isn't exactly old. It's relatively new. You might be one of the unlucky souls who are experiencing a fault. As a Yosemite use, I have experienced only one problem so far, which is my desktop background turning blue... still there today :/ But, anyway:
-- Have a look online (on your phone, or a laptop) to make sure it isn't a bug and see if it's got any solutions.
-- You might have it plugged in to a faulty socket. Try using a different one.
-- Check your power cable and your plug to make sure they're both in nice and tight. I had the same problem once. I was logging in and a few minutes later it would shut down. Turns out my power cable (back of the IMac) was loose. Put it back in and it worked like a charm.
-- Try logging in to a different account, such as the Guest account, or make another account.
-- Try rebooting the system
-- Leave it for a few days. It might be overheating, or it might just be exhausted. Give it some time to cool down (up to a week at most).
-- If you're able to get back on, try deleting stuff you don't need. Less storage space being used means the IMac gets to relax a little. If you CAN'T get back on...
-- ...take it to your local Apple Store and get them to take a look at it. There might be something wrong with the insides e.g. one of the fans could quite possibly be broken. And if they can't help you, then...
-- ...it might be done. Capoot. Frazzled. You have worn out it's lifespan and milked it dry, which in that case you would, obviously, need to buy a new one. If you're warranty hasn't expired, you can receive a new one. Neat!
Tell me if you have any success buddy :)