Skip to content
This repository has been archived by the owner on Jun 15, 2018. It is now read-only.

Commit

Permalink
fix cleanup crash
Browse files Browse the repository at this point in the history
  • Loading branch information
rodneymo committed Sep 4, 2017
1 parent f91be0c commit b69547e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 2 additions & 0 deletions cleanup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ BASE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd $BASE_DIR

. ${BASE_DIR}/conf/rig-monitor.conf
. ${BASE_DIR}/utils/functions

# epoch TIME
_TIME=`date +%s`
Expand Down Expand Up @@ -44,6 +45,7 @@ if [ "$POOL_NAME" == "ETHERMINE" ]; then
EXPIRED_ETHERMINE_PAYOUTS_SQL="DELETE FROM ethermine_payouts WHERE UNIX_TIMESTAMP(paidon) < ${EXPIRED_DATA};"
echo "SQL TO REMOVE EXPIRED ETHERMINE PAYOUTS DATA: $EXPIRED_ETHERMINE_PAYOUTS_SQL"
echo $EXPIRED_ETHERMINE_PAYOUTS_SQL | mysql -v -v -u ${GRAFANA_DB_USER} -p${GRAFANA_DB_PWD} --local-infile rigdata
fi

#archive old status and info files
while (( LAST_CLEANUP < TIME )); do
Expand Down
9 changes: 5 additions & 4 deletions utils/functions
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
bookkeeping () {
RESET_DATE=`date --date="-1 month" +%s`
if [ ! -f ${RECORD_LOG} ]; then
touch ${RECORD_LOG}
echo "LAST_INGESTED_CLAYMORE_STATUS=0" >> ${RECORD_LOG}
echo "LAST_INGESTED_ETHERMINE_PAYOUTS=0" >> ${RECORD_LOG}
echo "LAST_INGESTED_ETHERMINE_STATS=0" >> ${RECORD_LOG}
echo "LAST_CLEANUP=0" >> ${RECORD_LOG}
echo "LAST_INGESTED_CLAYMORE_STATUS=RESET_DATE" >> ${RECORD_LOG}
echo "LAST_INGESTED_ETHERMINE_PAYOUTS=RESET_DATE" >> ${RECORD_LOG}
echo "LAST_INGESTED_ETHERMINE_STATS=RESET_DATE" >> ${RECORD_LOG}
echo "LAST_CLEANUP=RESET_DATE" >> ${RECORD_LOG}
fi

# read to associative array
Expand Down

0 comments on commit b69547e

Please sign in to comment.