package cc.mrbird.febs.restart; import lombok.extern.slf4j.Slf4j; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; import java.io.IOException; @Slf4j @Component public class RestartJob { /** * 每天凌晨一点,去shellpath目录下运行reset-mall-rabbit.sh脚本文件,实现项目的每日定时重启 * 目的:BSC的区块链监听问题,解决重连问题 * @throws IOException */ @Scheduled(cron = "0 0 1 * * ? ") public void autoRestart() throws IOException { String shellpath="sh /home/javaweb/cron/reset-mall-rabbit.sh"; Process ps = Runtime.getRuntime().exec(shellpath); } }