modify script schedule
This commit is contained in:
parent
6f0f77878d
commit
8f6ae40287
@ -1,6 +1,7 @@
|
|||||||
package top.baogutang.admin.schedule;
|
package top.baogutang.admin.schedule;
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.cloud.context.config.annotation.RefreshScope;
|
import org.springframework.cloud.context.config.annotation.RefreshScope;
|
||||||
import org.springframework.scheduling.annotation.Scheduled;
|
import org.springframework.scheduling.annotation.Scheduled;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
@ -18,6 +19,9 @@ import javax.annotation.Resource;
|
|||||||
@RefreshScope
|
@RefreshScope
|
||||||
public class ScriptSchedule {
|
public class ScriptSchedule {
|
||||||
|
|
||||||
|
|
||||||
|
@Value("${baogutang.script.switch:false}")
|
||||||
|
private Boolean scriptExecSwitch;
|
||||||
@Resource
|
@Resource
|
||||||
private IScriptService scriptService;
|
private IScriptService scriptService;
|
||||||
|
|
||||||
@ -26,8 +30,12 @@ public class ScriptSchedule {
|
|||||||
*/
|
*/
|
||||||
@Scheduled(cron = "0 50 11 * * ?")
|
@Scheduled(cron = "0 50 11 * * ?")
|
||||||
public void maoTaiScript() {
|
public void maoTaiScript() {
|
||||||
|
if (!Boolean.TRUE.equals(scriptExecSwitch)) {
|
||||||
|
log.warn(">>>>>>>>>>scriptExecSwitch closed!<<<<<<<<<<");
|
||||||
|
return;
|
||||||
|
}
|
||||||
log.info(">>>>>>>>>>schedule start exec maoTai script<<<<<<<<<<<");
|
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<<<<<<<<<<");
|
log.info(">>>>>>>>>>schedule exec maoTai script end<<<<<<<<<<");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user