updated bash script

This commit is contained in:
Frederik Baerentsen 2022-07-15 10:02:14 +02:00
parent 376d57934d
commit 24cb19ba91

View File

@ -2,7 +2,6 @@
d=`date +%Y%m%d`
log2file() {
echo "sh: $1" >> "log/$d.log"
}
@ -13,23 +12,25 @@ error_exit() {
}
touch "log/$d.log"
echo "log: $d" >> "log/$d.log"
log2file "Starting update.sh"
fromdate=$(ls -1 *_latest.mcl |grep -Eo '[[:digit:]]{8}') || error_exit "cannot latest mcl file"
python2 update_missing.py
#mv "$d"".mcl" "$d""_latest.mcl" || error_exit "cannot cp $d to latest"
log2file "Moving old file to archive"
mv "$fromdate""_latest.mcl" "archive/""$fromdate"".mcl" || error_exit "cannot mv to archive"
log2file "git add"
git add "$d""_latest.mcl" "archive/" "log/" >> "log/$d.log" || error_exit "cannot git add"
log2file "git rm"
git rm "$fromdate""_latest.mcl" >> "log/$d.log" || error_exit "cannot git rm"
log2file "git commit"
git commit -m "Updated $d" >> "log/$d.log" || error_exit "cannot git commit"
log2file "git push"
git push origin master >> "log/$d.log" || error_exit "cannot git push"