2022-07-08 10:29:37 +02:00
|
|
|
#!/bin/bash
|
2022-07-08 11:22:30 +02:00
|
|
|
|
2022-07-15 09:53:26 +02:00
|
|
|
d=`date +%Y%m%d`
|
2022-07-08 11:22:30 +02:00
|
|
|
|
2022-07-08 10:29:37 +02:00
|
|
|
|
2022-07-15 09:53:26 +02:00
|
|
|
log2file() {
|
|
|
|
echo "sh: $1" >> "log/$d.log"
|
|
|
|
}
|
2022-07-08 10:29:37 +02:00
|
|
|
|
2022-07-15 09:53:26 +02:00
|
|
|
error_exit() {
|
|
|
|
log2file "Error: $1"
|
|
|
|
exit 1
|
|
|
|
}
|
2022-07-12 12:07:49 +02:00
|
|
|
|
2022-07-15 09:53:26 +02:00
|
|
|
touch "log/$d.log"
|
2022-07-08 11:22:30 +02:00
|
|
|
|
2022-07-15 09:53:26 +02:00
|
|
|
echo "log: $d" >> "log/$d.log"
|
2022-07-08 10:29:37 +02:00
|
|
|
|
2022-07-15 09:53:26 +02:00
|
|
|
log2file "Starting update.sh"
|
2022-07-08 10:29:37 +02:00
|
|
|
|
2022-07-15 09:53:26 +02:00
|
|
|
fromdate=$(ls -1 *_latest.mcl |grep -Eo '[[:digit:]]{8}') || error_exit "cannot latest mcl file"
|
2022-07-08 10:29:37 +02:00
|
|
|
|
2022-07-15 09:21:05 +02:00
|
|
|
python2 update_missing.py
|
2022-07-08 10:38:46 +02:00
|
|
|
|
2022-07-15 09:53:26 +02:00
|
|
|
#mv "$d"".mcl" "$d""_latest.mcl" || error_exit "cannot cp $d to latest"
|
2022-07-15 09:21:05 +02:00
|
|
|
mv "$fromdate""_latest.mcl" "archive/""$fromdate"".mcl" || error_exit "cannot mv to archive"
|
|
|
|
|
2022-07-15 09:53:26 +02:00
|
|
|
git add "$d""_latest.mcl" "archive/" "*" >> "log/$d.log" || error_exit "cannot git add"
|
2022-07-15 09:21:05 +02:00
|
|
|
|
2022-07-15 09:53:26 +02:00
|
|
|
git commit -m "Updated $d" >> "log/$d.log" || error_exit "cannot git commit"
|
2022-07-15 09:21:05 +02:00
|
|
|
|
2022-07-15 09:53:26 +02:00
|
|
|
git push origin master >> "log/$d.log" || error_exit "cannot git push"
|
2022-07-08 10:29:37 +02:00
|
|
|
|