better webhoo echo -e \nExisting Webhook and Tag found. Using those values unless you enter new ones.\n

This commit is contained in:
2025-08-23 18:31:32 -06:00
parent 33164a852c
commit 6178611e97
2 changed files with 13 additions and 3 deletions
+3 -2
View File
@@ -23,10 +23,11 @@ fi
echo -e "\nConfigure Discord Webhook Settings" echo -e "\nConfigure Discord Webhook Settings"
if [ -f /tmp/tag.txt ] && [ -f /tmp/webhook.txt ]; then if [ -f /tmp/tag.txt ] && [ -f /tmp/webhook.txt ]; then
echo -e "\nExisting Webhook and Tag found. Using those values unless you enter new ones.\n"
existing_webhook=$(cat /tmp/webhook.txt) existing_webhook=$(cat /tmp/webhook.txt)
existing_tag=$(cat /tmp/tag.txt) existing_tag=$(cat /tmp/tag.txt)
echo -e "\nExisting Webhook and Tag found. Using those values unless you enter new ones.\n"
echo -e "Existing Webhook URL: $existing_webhook" echo -e "Existing Webhook URL: $existing_webhook"
echo -e "Existing Tag: $existing_tag\n" echo -e "Existing Tag: $existing_tag\n"
+10 -1
View File
@@ -1,7 +1,11 @@
#!/bin/bash #!/bin/bash
# usage: webhook [message/mode] [notify]
## webhook bootup # for bootup mode
## webhook "silly soemething" # for normal webhook message
## webhook "silly osmething" true # to ping with normal message
# usage in cron # usage in cron
## @reboot bash /usr/share/customscripts/ifnet "/usr/share/customscripts/webhook bootup" ## @reboot bash /usr/share/customscripts/ifnet "/usr/share/customscripts/webhook bootup"
# discord_webhook="https://discord.com/api/webhooks/yourwebhook"
discord_webhook=$(cat /usr/share/customscripts/webhook.txt) discord_webhook=$(cat /usr/share/customscripts/webhook.txt)
ipaddr=$(hostname -I | grep -E -o "10.0.0.[0-9]{1,3}" | tr '\n' ' ') ipaddr=$(hostname -I | grep -E -o "10.0.0.[0-9]{1,3}" | tr '\n' ' ')
date=$(date "+%d/%m/%Y %H:%M:%S %Z (%s)") date=$(date "+%d/%m/%Y %H:%M:%S %Z (%s)")
@@ -19,6 +23,11 @@ else
content="$1" content="$1"
fi fi
# any value in $2 will do ping mode
if [ ! -z $2 ]; then
content+="\n$tag"
fi
post_data() { post_data() {
cat <<EOF cat <<EOF
{ {