diff --git a/baogutang-admin/src/main/java/top/baogutang/admin/schedule/ScriptSchedule.java b/baogutang-admin/src/main/java/top/baogutang/admin/schedule/ScriptSchedule.java index 7b3ac81..3d438f9 100644 --- a/baogutang-admin/src/main/java/top/baogutang/admin/schedule/ScriptSchedule.java +++ b/baogutang-admin/src/main/java/top/baogutang/admin/schedule/ScriptSchedule.java @@ -1,6 +1,7 @@ package top.baogutang.admin.schedule; import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Value; import org.springframework.cloud.context.config.annotation.RefreshScope; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; @@ -18,6 +19,9 @@ import javax.annotation.Resource; @RefreshScope public class ScriptSchedule { + + @Value("${baogutang.script.switch:false}") + private Boolean scriptExecSwitch; @Resource private IScriptService scriptService; @@ -26,8 +30,12 @@ public class ScriptSchedule { */ @Scheduled(cron = "0 50 11 * * ?") public void maoTaiScript() { + if (!Boolean.TRUE.equals(scriptExecSwitch)) { + log.warn(">>>>>>>>>>scriptExecSwitch closed!<<<<<<<<<<"); + return; + } log.info(">>>>>>>>>>schedule start exec maoTai script<<<<<<<<<<<"); - scriptService.execPython("/usr/local/scripts/10-07MaoTai/main.py"); + scriptService.execPython("/usr/local/scripts/10-13MaoTai/main.py"); log.info(">>>>>>>>>>schedule exec maoTai script end<<<<<<<<<<"); } }