Skip to content

Commit

Permalink
cron
Browse files Browse the repository at this point in the history
  • Loading branch information
wushuo894 committed Jun 8, 2024
1 parent b3f920c commit ccc8952
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/main/java/com/emby/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ public static void main(String[] args) {
map.putAll(argsMap);
map.putAll(envMap);

Boolean run = Boolean.TRUE;

for (Map.Entry<String, String> stringStringEntry : map.entrySet()) {
String k = stringStringEntry.getKey();
String v = stringStringEntry.getValue();
Expand All @@ -57,6 +59,9 @@ public static void main(String[] args) {
if (List.of("-c", "--cron", "CRON").contains(k)) {
cron = v;
}
if (List.of("-r", "--run", "RUN").contains(k)) {
run = Boolean.parseBoolean(v);
}
}

HttpUtil.createServer(port)
Expand All @@ -76,7 +81,13 @@ public static void main(String[] args) {
}).start();

Main main = new Main();
main.run();
try {
if (run) {
ThreadUtil.execute(main);
}
} catch (Exception e) {
log.error(e);
}

if (StrUtil.isNotBlank(cron)) {
CronUtil.schedule(cron, main);
Expand Down

0 comments on commit ccc8952

Please sign in to comment.