Endospore formation is usually triggered by a lack of nutrients, and usually occurs in Gram-positive bacteria.