2022-07-08 10:29:37 +02:00
|
|
|
#!/bin/bash
|
2022-07-08 11:22:30 +02:00
|
|
|
|
|
|
|
error_exit() {
|
|
|
|
echo "Error: $1"
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
|
|
|
source ../.apikey || error_exit "Cannot find apikey"
|
2022-07-08 10:29:37 +02:00
|
|
|
|
|
|
|
d=`date +%Y%m%d`
|
|
|
|
#mv "missing.mcl" "missing_old.mcl"
|
|
|
|
|
2022-07-08 11:22:30 +02:00
|
|
|
fromdate=$(ls -1 *_latest.mcl |grep -Eo '[[:digit:]]{8}') || error_exit "cannot latest mcl file"
|
2022-07-12 12:07:49 +02:00
|
|
|
fromdate2=$(date -d "$fromdate" +%Y-%m-%d)
|
|
|
|
|
|
|
|
d2=`date +%Y-%m-%d`
|
2022-07-08 11:22:30 +02:00
|
|
|
|
2022-07-12 12:07:49 +02:00
|
|
|
TEMP=$(echo "update_missing.py" "$fromdate""_latest.mcl" "$d"".mcl" "$api_key" "$fromdate2" "$d2")
|
2022-07-08 10:29:37 +02:00
|
|
|
|
2022-07-12 12:07:49 +02:00
|
|
|
/usr/bin/python2 $TEMP
|
2022-07-08 10:29:37 +02:00
|
|
|
|
2022-07-12 12:07:49 +02:00
|
|
|
#exit
|
2022-07-08 10:29:37 +02:00
|
|
|
|
2022-07-12 12:07:49 +02:00
|
|
|
#mv "$d"".mcl" "$d""_latest.mcl" || error_exit "cannot cp $d to latest"
|
|
|
|
#mv "$fromdate""_latest.mcl" "archive/""$fromdate"".mcl" || error_exit "cannot mv to archive"
|
2022-07-08 10:38:46 +02:00
|
|
|
|
2022-07-12 12:07:49 +02:00
|
|
|
#git add "$d""_latest.mcl" "archive/"
|
|
|
|
#git commit -m "Updated $d"
|
2022-07-08 10:38:46 +02:00
|
|
|
|
2022-07-08 11:22:30 +02:00
|
|
|
#git push origin master
|
2022-07-08 10:29:37 +02:00
|
|
|
|