Cesspits were cleaned out by tradesmen known in the UK as gongfermors using shovels and horse-drawn wagons. Cesspools were cleaned only at night, to reduce the smell and annoyance to the public. The typical cesspit was cleaned out once every 8 to 10 years.
Not that they had health codes or even germs theory, it's a really bad idea to use human waste as fertilizer. At least not without proper composting. Again, not really sure they would know that. I presume that any groups that tried it either realized not to do it quickly and wrote rules against it or died off.
Fun observation. Consider how many Jewish rules have a sanitation effect. They might now have completely understood what was happening, but they could see the effects of good food inspection and regular bathing.