I tried to use the Curve modifier ...
... but the motion isn't the same as real one.
Add the curve modifier as you probably did and move the curve.
If it does not work as expected, invert the curve direction (in edit mode for the curve, use the menu "segments/switch direction").
This may be easy solution for you, use curve as you did with your chain and use hook on the curve... set it to object that will be your CNC head and that 1 point of the curve next to the head will be hooked to it... Result is this:
By moving the cube you can easily control whole movement, it has some limitations of course, but you can solve them as well
Check it if you understand and see if it works, if you need to limit other movement, you should use another objects to control that curve