Add a check of the environment when control the service