updated bash script
This commit is contained in:
parent
376d57934d
commit
24cb19ba91
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
d=`date +%Y%m%d`
|
d=`date +%Y%m%d`
|
||||||
|
|
||||||
|
|
||||||
log2file() {
|
log2file() {
|
||||||
echo "sh: $1" >> "log/$d.log"
|
echo "sh: $1" >> "log/$d.log"
|
||||||
}
|
}
|
||||||
@ -13,23 +12,25 @@ error_exit() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
touch "log/$d.log"
|
touch "log/$d.log"
|
||||||
|
|
||||||
echo "log: $d" >> "log/$d.log"
|
echo "log: $d" >> "log/$d.log"
|
||||||
|
|
||||||
log2file "Starting update.sh"
|
log2file "Starting update.sh"
|
||||||
|
|
||||||
fromdate=$(ls -1 *_latest.mcl |grep -Eo '[[:digit:]]{8}') || error_exit "cannot latest mcl file"
|
fromdate=$(ls -1 *_latest.mcl |grep -Eo '[[:digit:]]{8}') || error_exit "cannot latest mcl file"
|
||||||
|
|
||||||
python2 update_missing.py
|
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"
|
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"
|
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"
|
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"
|
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"
|
git push origin master >> "log/$d.log" || error_exit "cannot git push"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user