Optimal control of the vacation scheme in an M/G/1 queue