We introduce the theoretical framework from geometric optimal control for a control system modeled by the Generalized Lotka-Volterra (GLV) equation, motivated by restoring the gut microbiota infected by Clostridium difficile combining antibiotic treatment and fecal injection. We consider both permanent control and sampled-data control related to the medical protocols.