It's safer to turn them on and off from time to time.
The most problematic components are electrolytic capacitors, especially the aluminium types which have been used plentiful in old computers. These parts lose their formation when not turned on from time to time, meaning the aluminium oxide between the contacted sheets gets thinner and thinner. This causes the fatal failure on turning on old hardware which was in the attic for dozens of years. It doesn't happen when you turn it on and off from time to time.
But why not running them all the time? Again, the aluminium electrolytic capacitors are the culprit. Their electrolyte dries up with the years, losing water to the aluminium sheets inside the capacitator. This happens faster when the part is heated. And unfortunately, when the part had lose some capacity, there is more ripple current in the circuit, so it's loaded more and heats up even more. This leads to a fatal failure when running a device 24/7.
The first thing I do with old hardware before turning it on is checking the Al caps. It was that way with grandpa's tube radio, with old tv sets and it's the same with old computers.
So, turn your old computers on once in a year or so, then put them to sleep again if they are fine.
EDIT: In old military parts, you will also find tantalum capacitators with a liquid electrolyte. These ones fail extremly miserably when the electrolyte is gone. Twenty years ago, I was at an electronics disposal facility, and one day we got a load of scrapped radar equipment from the Bundeswehr which originated in GDR/Soviet Union. They used those parts in huge amounts. There was one FR4 board with a fist-sized hole blown into it. I eventually found another board of the same type which had a big liquid electrolyte tantalum cap at the place the hole was on the other board.