That is what search engines are for, other Googles are available.
Yes you need a limit switch, over time any use of timing will drift.
A limit switch is a switch that is pushed down by a moving object. Often micro switches are used.
Some commercial actuators might come with a built in limit switch but those are expensive.