It would be nice to add a couple of additional switches to automatically stop the motor when it has gone too far but still allow the operator to return the motor to an allowed position. When the right limit sw is activated the relay coil is energized reversing the motor direction to the left.
4 Stroke High Speed 1000 Lbs 12 Volt Dc Linear Actuator W Limit Switches
Dc motor reversing circuit with limit switches. Diode will allow motor to go in reverse direction. Wiring diagram of a dpdt connected motor plus two snap action switches for user control with limit stops. Switch stops motor at limit and diode allows reversing of motor. It doesnt start on its own you have to push a limit switch. It doesnt have interlocks or a stop button but it can all be added to it. The motor runs to the right with the relay de energized as shown.
It consists of a dpdt relay two spdt limit switches and 5 diodes. Normally upper and lower are closed but at limits one will open and shuts off motor. The circuit uses 2 relays 2 limit switches and a dc motor. This is a minimal reversing circuit. The interlocks are specially important because if both relays are on it would be a short circuit. Diode will be reversed biased.
Below is a simple circuit that should do what you want.