added parameter for name

This commit is contained in:
2022-01-27 19:18:51 -05:00
parent 932a79d2ad
commit b352c50bb2

View File

@@ -2,6 +2,7 @@
URL=${1}
PHONE_NUMBER=${2}
NAME=${3}
SOURCE_FILE='/tmp/source.html'
@@ -10,7 +11,7 @@ wget -qO ${SOURCE_FILE} ${URL}
INVENTORY_QUANTITY=$(grep -o -m 1 '"inventory_quantity":[0-9]\+,' ${SOURCE_FILE} | grep -o '[0-9]\+')
if [[ "${INVENTORY_QUANTITY}" -gt "0" ]]; then
MESSAGE="There are currently ${INVENTORY_QUANTITY} in stock. ${URL}"
MESSAGE="There are currently ${INVENTORY_QUANTITY} ${NAME} in stock. ${URL}"
echo "${MESSAGE}"
echo "${PHONE_NUMBER}"
echo "${MESSAGE}" | mailx -r "stockalerts@johnhgaunt.com" --set smtp="smtp.home.johnhgaunt.com:25" ${PHONE_NUMBER}@vtext.com