From 24cb19ba9128c2201aa34dac62c2bcc40e7fbe41 Mon Sep 17 00:00:00 2001 From: Frederik Baerentsen Date: Fri, 15 Jul 2022 10:02:14 +0200 Subject: [PATCH] updated bash script --- Update Missing/update.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Update Missing/update.sh b/Update Missing/update.sh index 08750a3..e83ee5c 100644 --- a/Update Missing/update.sh +++ b/Update Missing/update.sh @@ -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"