Skip to content

Instantly share code, notes, and snippets.

@doob187
Last active October 17, 2021 14:15
Show Gist options
  • Save doob187/3b978b60d4ec5a248239db76b621c8e4 to your computer and use it in GitHub Desktop.
Save doob187/3b978b60d4ec5a248239db76b621c8e4 to your computer and use it in GitHub Desktop.
puller.sh
#!/usr/bin/with-contenv bash
# shellcheck shell=bash
jq --version >/dev/null 2>&1
jq_ok=$?
[[ "$jq_ok" -eq 127 ]] && \
echo "fatal: jq not installed || installing now" && apt install jq -yqq
SDISCORD=/opt/scripts/discord.sh
DISCORD_WEBHOOK_URL=
DISCORD_NAME_OVERRIDE=
DISCORD_EMBED_TITEL=
DISCORD_ICON_OVERRIDE=
RCLONELOG=
LOG="/tmp/discord.dead"
if [[ ! -d "/opt/scripts" ]];then mkdir -p /opt/scripts;fi
if [[ ! -f ${SDISCORD} ]];then
curl --silent -fsSL https://raw.githubusercontent.com/ChaoticWeg/discord.sh/master/discord.sh -o "${SDISCORD}"
chmod 755 "${SDISCORD}"
fi
tail -Fn0 ${RCLONELOG} | \
while read line ; do
echo "$line" | grep "downloadQuotaExceeded"
if [[ ! -f "${LOG}" ]]; then
bash "${SDISCORD}" \
--webhook-url=${DISCORD_WEBHOOK_URL} \
--title "${DISCORD_EMBED_TITEL}" \
--avatar "${DISCORD_ICON_OVERRIDE}" \
--author "SERVER--Bot" \
--username "${DISCORD_NAME_OVERRIDE}" \
--description "${MSGSEND}" \
--thumbnail "https://www.freeiconspng.com/uploads/error-icon-4.png" \
--timestamp > ${LOG}
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment