Skip to content

Commit

Permalink
Update interval files correctly if not yet full.
Browse files Browse the repository at this point in the history
This fixes #45.
  • Loading branch information
jhoenicke committed May 14, 2021
1 parent 6ba79e2 commit 88c759a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion updatedata.sh
Expand Up @@ -19,7 +19,8 @@ updatefile() {
MINUTES=$2
IVAL=$3
if [ `expr $MINUTE % $IVAL` -eq "0" ]; then
(echo 'call(['; tail -n +3 $DESTDIR/$NAME.js | head -n -1; echo "$LINE"; echo '])') > $DESTDIR/$NAME.js.new
LINES=`expr $MINUTES / $IVAL - 1`
(echo 'call(['; grep '^\[' $DESTDIR/$NAME.js | tail -n $LINES; echo "$LINE"; echo '])') > $DESTDIR/$NAME.js.new
mv $DESTDIR/$NAME.js.new $DESTDIR/$NAME.js
fi
}
Expand Down

0 comments on commit 88c759a

Please sign in to comment.