moved csv cleanup to startup

This commit is contained in:
olli 2023-06-19 17:50:18 +02:00
parent ab4ea889d1
commit cce49bec63
2 changed files with 8 additions and 3 deletions

View File

@ -33,6 +33,14 @@ touch firstloop
# am I the bot (important for functions used by analyze.sh
echo $0 | grep -q "dabo-bot\.sh" && BOT=1
# cleanup trashlines in asset-histories (possibly generated by kill further of this progress)
find asset-histories -name "*.csv" -type f | while read csv_file
do
csv_timestamp=$(ls --time-style='+%Y%m%d%H%M' -l "${csv_file}" | cut -d" " -f6)
sed -i "/[0-9]$(date +%Y)-/d" ${csv_file}
touch -t ${csv_timestamp} "${csv_file}"
done
# run endless loop
while true
do

View File

@ -95,9 +95,6 @@ function get_assets {
export csv_headline
. /tmp/parallel
# cleanup trashlines (possibly generated by kill further of this progress)
sed -i "/[0-9]$(date +%Y)-/d" asset-histories/*
# get MSCI World Index for analysis
echo "wget -q -O - https://www.boerse.de/realtime-kurse/MSCI-World/XC0009692739 | egrep 'itemprop=\"price\" content=\"[0-9]+\.[0-9]+\"' | cut -d\\\" -f6" >MSCI_WORLD_CMD
g_runcmd g_retrycmd sh MSCI_WORLD_CMD >MSCI_WORLD_CMD_OUT.tmp