Fix date being null

This commit is contained in:
Dessalines 2018-11-26 11:37:45 -07:00
parent 8a2d934048
commit 945c2b499a
1 changed files with 6 additions and 1 deletions

View File

@ -46,7 +46,12 @@ for torrent_file in *.torrent; do
leechers=$(jq -r '.peers' <<< $health_text)
completed=$(jq -r '.completed' <<< $health_text)
date_string=$(jq -r '.created' <<< $health_text)
if [ -z $date_string ]; then
echo "Date was null, setting to now"
created_date=$(date +%s)
else
created_date=$(date -d "${date_string}" +"%s")
fi
scraped_date=$(date +%s)
# Construct add line