-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.js
34 lines (32 loc) · 1012 Bytes
/
main.js
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
33
34
function myFunction() {
const ownUrls = [
'https://wasabina67.github.io/',
'https://marunaka-food-corp.github.io/caremeat-carefish/',
'https://marunaka-food-corp.github.io/tidus-shikaniku-curry/',
'https://marunaka-food-corp.github.io/ondotori-ws-settings/',
'https://garage-mash.com/',
'https://dmash-line.com/',
];
healthcheck(ownUrls);
const otherUrls = [
'http://www.marunaka-food.co.jp/',
'https://www.garagemash.com/',
];
healthcheck(otherUrls);
}
function healthcheck(urls) {
urls.forEach((url) => {
try {
const resp = UrlFetchApp.fetch(url, { muteHttpExceptions: true });
const code = resp.getResponseCode();
if (code !== 200) {
throw new Error('Not healthy | url: ' + url + ' | code: ' + code);
}
} catch (e) {
Logger.log(e);
// const recipient = Session.getActiveUser().getEmail();
const recipient = 'wasabina67@gmail.com';
GmailApp.sendEmail(recipient, 'healthcheck-gas', e);
}
})
}