-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscheduler.js
More file actions
32 lines (24 loc) · 1.06 KB
/
scheduler.js
File metadata and controls
32 lines (24 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
const cron = require('node-cron');
const { checkDustAndAlert } = require('./services/checkdustandalert.js');
const { checkDailyCommit } = require('./services/checkdailycommit.js');
const { alertLowBattery } = require('./services/alertlowbattery.js');
function initScheduledTasks(client) {
// Test space (instant run)
// 잔디심기 알리미 0 8-22/2 * * * // 1분간격(테스트용) : * * * * *
cron.schedule('0 8-22/2 * * *', () => {
checkDailyCommit(client);
});
// 미세먼지 주기적 알림
cron.schedule('*/10 9-21 * * *', () => {
checkDustAndAlert(client);
});
// 서버 배터리 알림
cron.schedule('*/10 9-21 * * *', () => {
alertLowBattery(client);
});
}
module.exports = { initScheduledTasks };
// 알림 가는 시간 조정 기능 ( 9 to 9 )
// cron delay settings : https://goodgirlgonebad.tistory.com/79
// https://velog.io/@jay2u8809/Crontab%ED%81%AC%EB%A1%A0%ED%83%AD-%EC%8B%9C%EA%B0%84-%EC%84%A4%EC%A0%95
// 0 */1 * * * : 매 정각마다 실행, 0,10,20,30,40,50 * * * * : 매 10분마다 실행