-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathcron.sh
More file actions
30 lines (20 loc) · 936 Bytes
/
Copy pathcron.sh
File metadata and controls
30 lines (20 loc) · 936 Bytes
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
#!/bin/bash
# See http://redsymbol.net/articles/unofficial-bash-strict-mode/
# explicitly without "-e" for it should not exit immediately when failed but write a mail
set -uo pipefail
# Execute via crontab by hduser@weywot1:
# 00 1 * * * ssh sol@quaoar1 "cd /home/sol/git/nwbib ; bash -x cron.sh >> logs/cron.sh.log 2>&1"
IFS=$'\n\t'
RECIPIENT=oi
rm -rf ./data
rm conf/wikidata.json
sbt "runMain SpatialToSkos"
CODE=$?
if ! [ $CODE -eq 0 ]; then
echo "Non-0 code: $CODE"
MISSING_NWBIB="$(cat conf/qid-p6814-missing-in-nwbib.csv)"
MISSING_WIKID="$(cat conf/qid-p6814-missing-in-wiki.csv)"
LOG="$(tail -n 50 logs/application.log)"
MESSAGE="Missing in NWBib:\n$MISSING_NWBIB \n\nSee https://github.com/hbz/nwbib/wiki/Umgang-mit-Wikidata%E2%80%90Item%E2%80%90Merges how to fix it.\n\nMissing in Wikidata:\n$MISSING_WIKID\n\nLog:\n$LOG"
echo -e "$MESSAGE" | mail -s "[sysad] [nwbib] Alert nwbib-spatial" "$RECIPIENT@hbz-nrw.de"
fi