Multiple Surfbars can be tracked (if you use unraid/Proxmox and got multiple LXC/Surfbars with VPN)

This commit is contained in:
Pakobbix 2023-02-10 18:29:13 +01:00
parent cd158fc0dc
commit d31d7e9f60

View File

@ -54,7 +54,7 @@ setup_config() {
) )
case "$messagehandler" in case "$messagehandler" in
SurfbarName) SurfbarName)
surflink=$(whiptail --title "Surfbar Link" --inputbox "Gebe hier den Namen deiner Surfbar ein\nBeispiel:\nHttps://www.ebesucher.de/surfbar/MeinSurfLink\nName ist hierbei: MeinSurfLink" 16 100 3>&2 2>&1 1>&3) surflink=$(whiptail --title "Surfbar Link" --inputbox "Gebe hier den Namen deiner Surfbar ein\nBeispiel:\nHttps://www.ebesucher.de/surfbar/MeinSurfLink\nName ist hierbei: MeinSurfLink\nEs können auch mehrere eingegeben werden." 16 100 3>&2 2>&1 1>&3)
if [ -n "$surflink" ]; then if [ -n "$surflink" ]; then
sed -i "s/SurfbarName=.*/SurfbarName=\"$surflink\"/g" $config sed -i "s/SurfbarName=.*/SurfbarName=\"$surflink\"/g" $config
fi fi
@ -196,7 +196,9 @@ if [ -z "$SurfbarName" ]; then
setup_config setup_config
fi fi
ProcessID=$(pgrep -f "surfbar/$SurfbarName") for SurfbarLinks in $SurfbarName; do
ProcessID=$(pgrep -f "surfbar/$SurfbarLinks")
case $NotificationHandler in case $NotificationHandler in
Discord) Discord)
@ -208,7 +210,7 @@ Discord)
exit 1 exit 1
else else
if [ -z "$ProcessID" ]; then if [ -z "$ProcessID" ]; then
curl -i -H "Accept: application/json" -H "Content-Type:application/json" -X POST --data "{\"content\": \"Ebesucher ist Abgestürzt.\n$SurfbarName läuft nicht mehr\"}" "$Discord_WebHookLink" &>/dev/null curl -i -H "Accept: application/json" -H "Content-Type:application/json" -X POST --data "{\"content\": \"Ebesucher ist Abgestürzt.\n$SurfbarLinks läuft nicht mehr\"}" "$Discord_WebHookLink" &>/dev/null
else else
exit 1 exit 1
fi fi
@ -239,9 +241,9 @@ Apprise)
else else
if [ -z "$ProcessID" ]; then if [ -z "$ProcessID" ]; then
if [ -n "$AppRiseTAG" ]; then if [ -n "$AppRiseTAG" ]; then
curl -d '{"body":"'"Ebesucher Container $SurfbarName ist down"'", "title":"Passive-Income Notification: Ebesucher ist Abgestürzt","tag":"'"$AppRiseTAG"'"}' -H "Content-Type: application/json" "$AppRiseURL" &>/dev/null curl -d '{"body":"'"Ebesucher Container $SurfbarLinks ist down"'", "title":"Passive-Income Notification: Ebesucher ist Abgestürzt","tag":"'"$AppRiseTAG"'"}' -H "Content-Type: application/json" "$AppRiseURL" &>/dev/null
else else
curl -d '{"body":"'"Ebesucher Container $SurfbarName ist down"'", "title":"Passive-Income Notification: Ebesucher ist Abgestürzt","tag":"all"}' -H "Content-Type: application/json" "$AppRiseURL" &>/dev/null curl -d '{"body":"'"Ebesucher Container $SurfbarLinks ist down"'", "title":"Passive-Income Notification: Ebesucher ist Abgestürzt","tag":"all"}' -H "Content-Type: application/json" "$AppRiseURL" &>/dev/null
fi fi
else else
exit 1 exit 1
@ -254,7 +256,7 @@ NextCloud)
exit 1 exit 1
else else
if [ -z "$ProcessID" ]; then if [ -z "$ProcessID" ]; then
curl -d '{"token":"'"$NextcloudTalkToken"'", "message":"'"Passive-Income Notification: Ebesucher ist Abgestürzt\nEbesucher Container $SurfbarName ist down"'"}' -H "Content-Type: application/json" -H "Accept:application/json" -H "OCS-APIRequest:true" -u "$NextcloudUser:$NextcloudPassword" "$NextcloudDomain"/ocs/v1.php/apps/spreed/api/v1/chat/tokenid &>/dev/null curl -d '{"token":"'"$NextcloudTalkToken"'", "message":"'"Passive-Income Notification: Ebesucher ist Abgestürzt\nEbesucher Container $SurfbarLinks ist down"'"}' -H "Content-Type: application/json" -H "Accept:application/json" -H "OCS-APIRequest:true" -u "$NextcloudUser:$NextcloudPassword" "$NextcloudDomain"/ocs/v1.php/apps/spreed/api/v1/chat/tokenid &>/dev/null
fi fi
fi fi
;; ;;
@ -267,7 +269,7 @@ PushBullet)
exit 1 exit 1
else else
if [ -z "$ProcessID" ]; then if [ -z "$ProcessID" ]; then
curl -u "$PushBulletToken": -X POST https://api.pushbullet.com/v2/pushes --header 'Content-Type: application/json' --data-binary '{"type": "note", "title": "Passive-Income Notification: Ebesucher ist Abgestürzt", "body": "Ebesucher Container '"$SurfbarName"' ist down"}' curl -u "$PushBulletToken": -X POST https://api.pushbullet.com/v2/pushes --header 'Content-Type: application/json' --data-binary '{"type": "note", "title": "Passive-Income Notification: Ebesucher ist Abgestürzt", "body": "Ebesucher Container '"$SurfbarLinks"' ist down"}'
else else
exit 1 exit 1
fi fi
@ -284,7 +286,7 @@ To: $mailrcpt $mailrcpt
Subject: Passive-Income Notification: Ebesucher ist Abgestürzt Subject: Passive-Income Notification: Ebesucher ist Abgestürzt
Hi $mailrcpt, Hi $mailrcpt,
Your Ebesucher Container $SurfbarName ist abgestürzt und läuft nicht mehr. Your Ebesucher Container $SurfbarLinks ist abgestürzt und läuft nicht mehr.
Bye!" >/root/pain_watchmail Bye!" >/root/pain_watchmail
curl "smtps://$smtpURL:$smtpPORT" --mail-from "$mailfrom" --mail-rcpt "$mailrcpt" -T /root/pain_watchmail -u "$mailuser:$mailpass" --ssl-reqd --insecure --show-error -s curl "smtps://$smtpURL:$smtpPORT" --mail-from "$mailfrom" --mail-rcpt "$mailrcpt" -T /root/pain_watchmail -u "$mailuser:$mailpass" --ssl-reqd --insecure --show-error -s
else else
@ -301,10 +303,11 @@ Rocket.Chat)
exit 1 exit 1
else else
if [ -z "$ProcessID" ]; then if [ -z "$ProcessID" ]; then
curl -X POST -H 'Content-Type: application/json' --data '{"text":"Passive-Income Notification: Ebesucher ist Abgestürzt","attachments":[{"title":"Passive-Income Notification: Ebesucher ist Abgestürzt","text":"Ebesucher Container '"$SurfbarName"' ist down","color":"#764FA5"}]}' "$RocketChatHook" curl -X POST -H 'Content-Type: application/json' --data '{"text":"Passive-Income Notification: Ebesucher ist Abgestürzt","attachments":[{"title":"Passive-Income Notification: Ebesucher ist Abgestürzt","text":"Ebesucher Container '"$SurfbarLinks"' ist down","color":"#764FA5"}]}' "$RocketChatHook"
else else
exit 1 exit 1
fi fi
fi fi
;; ;;
esac esac
done