Depends on how the boom is mounted. You will need a mechanism to move the boom from left to right, probably an axle from the boom down the mast into the underground where a motor is mounted to rotate the boom.
I finally found the
thread I was looking for. Have a look at post #20. It does exactly what you are looking for: rotate a disk (here you would use the axle) back and forth.
All you need is a geared motor and a dpdt switch. Plus the skills to mate the motor to the disk and the axle to the crane.
Btw: Personally I wouldn't
shake a crane from left to right,
swing it and it will look much more natural.