Are you using Mach3? That has a bunch of built-in wizards for this kind of thing. Can't remember if LinuxCNC does as well but it seems likely that someone has an add-on if not. I've never used this bit of Mach3 myself so can't say much about it apart from knowing that it's there.