there are several things to consider using solenoid valves, you will be required to add a separate relief valve before the solenoid valve to adjust the pressure setting. you will also need a valve large enough to handle your oil flow. A quick look at surplus centers website shows this 21gpm valve
12 VDC 21 GPM ARGO RPE3-6 DA HYDRAULIC DO3 SOLENOID VALVE | Solenoid Valves | Hydraulic Valves | Hydraulics | www.surpluscenter.com that should work. You will also have to purchase this subplate,
1 STATION DO3 SUBPLATE OPEN CENTER | Subplates | Hydraulic Adapters & Fittings | Hydraulics | www.surpluscenter.com to go with the valve, or they also have multisection subplates if you want to control more functions.
Next you will need some sort of switch to swap which solenoid you want to control. I like going heavy duty with something like these,
Heavy-Duty Limit Switches. You can get by with smaller,, cheaper type switches, but you get what you pay for. You will also need to wire in a electric power supply stop button so you can cut the elec, to the solenoid valve and prevent cycle.
To make the limit switch work with the valve, you will need to fabricate some sort of plunger or sliding rod that will trip the switch at each end of the stroke. The switch would need to be wired so that when centered, it operates one end of the solenoid valve and when activated, it sends power to the opposite side of the valve. my suggestion for the switch activating rod would be to attach a rod to the side of the beam so that it will float in each direction. On each end of the rod attach a piece of angle iron that the pusher plate can contact at each end of its stroke. When the cyl is fully retracted it will activate the limit switch in one direction and stay in that position until the pusher plate reaches full extension when it would pull the rod away from the limit switch, thus reversing the electric current and energizing the opposite solenoid. I dont know if I explained that where you can understand it, but this would be the easiest method I can think of to have a continuous cycle.
The solenoid valve and subplate are rated for 3050psi, you would want to adjust your relief valve at or below, ( I would stay at lease 100psi below the 3050psi rateing) that number and your tonnage will be a product of the relief setting and your cyl size