mirror of
https://github.com/Pakobbix/passive-income.git
synced 2026-01-02 08:10:33 +00:00
Compare commits
12 Commits
master
...
Notificati
| Author | SHA1 | Date | |
|---|---|---|---|
| 2d07f7a321 | |||
| 3814c3f598 | |||
| cd9c64baa2 | |||
| a90c4c7a28 | |||
| d23d1752ca | |||
| d31d7e9f60 | |||
| cd158fc0dc | |||
| 30c662ce1a | |||
| 4214ee1071 | |||
| 2786b80d52 | |||
| d0a8339efc | |||
| 39a214153f |
74
NotificationHandler/config
Normal file
74
NotificationHandler/config
Normal file
@@ -0,0 +1,74 @@
|
||||
#############################################################################################
|
||||
# _ _ _ _ __ _ _ _ _ _ _ _ #
|
||||
# | \ | | ___ | |_(_)/ _(_) ___ __ _| |_(_) ___ _ __ | | | | __ _ _ __ __| | | ___ _ __ #
|
||||
# | \| |/ _ \| __| | |_| |/ __/ _ | __| |/ _ \| _ \| |_| |/ _ | _ \ / _ | |/ _ \ __| #
|
||||
# | |\ | (_) | |_| | _| | (_| (_| | |_| | (_) | | | | _ | (_| | | | | (_| | | __/ | #
|
||||
# |_| \_|\___/ \__|_|_| |_|\___\__,_|\__|_|\___/|_| |_|_| |_|\__,_|_| |_|\__,_|_|\___|_| #
|
||||
# #
|
||||
# _ __ __ _ _ _ #
|
||||
# | |/ /___ _ __ / _(_) __ _ _ _ _ __ __ _| |_(_) ___ _ __ #
|
||||
# | // _ \| _ \| |_| |/ _ | | | | __/ _ | __| |/ _ \| _ \ #
|
||||
# | \ (_) | | | | _| | (_| | |_| | | | (_| | |_| | (_) | | | | #
|
||||
# |_|\_\___/|_| |_|_| |_|\__, |\__,_|_| \__,_|\__|_|\___/|_| |_| #
|
||||
# |___/ #
|
||||
#############################################################################################
|
||||
|
||||
SurfbarName="" # https://ebesucher.de/surfbar/SURFBARNAME Das in Großbuchstaben muss dann hier eingegeben werden
|
||||
NotificationHandler="" # Schreibe hier Discord, Telegram, Apprise, Nextcloud, Pushbullet, Mail oder RocketChat ein.
|
||||
|
||||
####################
|
||||
# Discord Settings #
|
||||
####################
|
||||
|
||||
Discord_WebHookLink=""
|
||||
|
||||
#####################
|
||||
# Telegram Settings #
|
||||
#####################
|
||||
|
||||
Telegram_UID=""
|
||||
Telegram_BT=""
|
||||
|
||||
####################
|
||||
# Apprise Settings #
|
||||
####################
|
||||
|
||||
AppRiseURL=""
|
||||
AppRiseTAG="" # Optional
|
||||
|
||||
######################
|
||||
# Nextcloud Settings #
|
||||
######################
|
||||
|
||||
NextcloudDomain=""
|
||||
NextcloudTalkToken=""
|
||||
NextcloudUser=""
|
||||
NextcloudPassword=""
|
||||
|
||||
#######################
|
||||
# PushBullet Settings #
|
||||
#######################
|
||||
# Achtung! Pushbullet hat ein Limit von maximal 500 Nachrichten pro Monat! Falls ihr viel damit hantiert, kann es sein, dass ich diese Überschreitet!
|
||||
|
||||
PushBulletToken=""
|
||||
|
||||
#################
|
||||
# Mail Settings #
|
||||
#################
|
||||
|
||||
smtpURL=""
|
||||
smtpPORT=""
|
||||
mailfrom=""
|
||||
mailrcpt=""
|
||||
mailuser="" # Ist meistens gleichzeitig auch mailfrom
|
||||
mailpass="" # Mail Password. Falls Gmail genutzt wird, muss in der Google Konto Verwaltung, Sicherheit, ein App Passwort erstellt werden!
|
||||
|
||||
########################
|
||||
# Rocket.Chat Settings #
|
||||
########################
|
||||
|
||||
RocketChatHook=""
|
||||
|
||||
########################
|
||||
# End of Configuration #
|
||||
########################
|
||||
81
gui_start.sh
81
gui_start.sh
@@ -8,6 +8,12 @@ erfolgreich=0
|
||||
fehler=0
|
||||
skip=0
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
if [ "$(whoami)" != "root" ]; then
|
||||
echo "Es ist leider erforderlich, dass das script als root ausgeführt wird!"
|
||||
exit
|
||||
fi
|
||||
|
||||
new_task() {
|
||||
echo -e "\n\n$(printf %"$(tput cols)"s | tr " " "=")\n$1\n$(printf %"$(tput cols)"s | tr " " "=")"
|
||||
}
|
||||
@@ -44,11 +50,11 @@ inputbox() {
|
||||
}
|
||||
|
||||
[ -d /etc/needrestart/ ] && sudo sed -i 's/#$nrconf{restart} = '"'"'i'"'"';/$nrconf{restart} = '"'"'a'"'"';/g' /etc/needrestart/needrestart.conf 2>/dev/null
|
||||
|
||||
sudo echo
|
||||
if ! which whiptail >/dev/null; then
|
||||
sudo apt-get install whiptail -y
|
||||
fi
|
||||
linux_user=$(w | awk '{print $1}' | tail -n1)
|
||||
{
|
||||
echo 0
|
||||
sudo apt-get update >/dev/null
|
||||
@@ -73,9 +79,6 @@ linux_user=$(w | awk '{print $1}' | tail -n1)
|
||||
if ! which docker >/dev/null; then
|
||||
messagebox "Kleinen Moment Geduld, Docker wird Installiert." "Das Fenster wird sich automatisch schließen, sobald Docker installiert wurde." &
|
||||
sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin >/dev/null
|
||||
messagebox "Docker wurde installiert" "Leider ist es notwendig, dass wir nun den PC Neustarten.\nNach dem Neustart, starte einfach von vorne. Das Skript wird dann aber durchlaufen"
|
||||
sudo usermod -aG docker $linux_user
|
||||
sudo reboot
|
||||
fi
|
||||
|
||||
whiptail --title "Passive Income Helperskript" --msgbox "Dieses Skript richtet mehrere Einkommenshelfer für dich ein.
|
||||
@@ -136,7 +139,7 @@ else
|
||||
;;
|
||||
EarnAPP)
|
||||
wget -qO- https://brightdata.com/static/earnapp/install.sh >/tmp/earnapp.sh && echo "yes" | sudo bash /tmp/earnapp.sh
|
||||
read -n1 -r -p "Drücke eine Taste, wenn du den Link im Browser geöffnet hast und das Gerät mit deinem Account verlinkt wurde..." key
|
||||
read -n1 -r -p "Drücke eine Taste, wenn du den Link im Browser geöffnet hast und das Gerät mit deinem Account verlinkt wurde..."
|
||||
;;
|
||||
|
||||
Packetstream)
|
||||
@@ -181,19 +184,18 @@ Ebesucher braucht leider etwas mehr Einrichtung. Aber keine Sorge, ich mach es d
|
||||
Zunächst erstellen wir einen Firefox Container.
|
||||
Dieser soll im Hintergrund die Werbeseiten aufrufen."
|
||||
|
||||
if [ -d ~/ebesucher ]; then
|
||||
if [ -d /root/ebesucher ]; then
|
||||
skip "Ordner ebesucher exestiert bereits"
|
||||
if ! [ -f ~/ebesucher/config.zip ]; then
|
||||
if ! [ -f /root/ebesucher/config.zip ]; then
|
||||
if whiptail --title "Alte config gefunden" --yesno "Es wurde bereits ein Firefox Profil angelegt, soll dieses gelöscht und überschrieben werden?" 20 100; then
|
||||
rm -f ~/ebesucher/config.zip
|
||||
wget -O ~/ebesucher/config.zip https://github.com/Pakobbix/passive-income/raw/master/config.zip
|
||||
unzip ~/ebesucher/config.zip -d ~/ebesucher/
|
||||
rm -f /root/ebesucher/config.zip
|
||||
wget -O /root/ebesucher/config.zip https://github.com/Pakobbix/passive-income/raw/master/config.zip
|
||||
unzip /root/ebesucher/config.zip -d /root/ebesucher/
|
||||
else
|
||||
unzip ~/ebesucher/config.zip -d ~/ebesucher/
|
||||
unzip /root/ebesucher/config.zip -d /root/ebesucher/
|
||||
fi
|
||||
fi
|
||||
else
|
||||
if [ "$linux_user" == "root" ]; then
|
||||
if mkdir /root/ebesucher; then
|
||||
wget -O /root/ebesucher/config.zip https://github.com/Pakobbix/passive-income/raw/master/config.zip
|
||||
unzip /root/ebesucher/config.zip -d /root/ebesucher/
|
||||
@@ -201,15 +203,6 @@ Dieser soll im Hintergrund die Werbeseiten aufrufen."
|
||||
else
|
||||
fehler "Der Ordner für ebesucher konnte nicht angelegt werden"
|
||||
fi
|
||||
else
|
||||
if mkdir /home/"$linux_user"/ebesucher; then
|
||||
wget -O /home/"$linux_user"/ebesucher/config.zip https://github.com/Pakobbix/passive-income/raw/master/config.zip
|
||||
unzip /home/"$linux_user"/ebesucher/config.zip -d /home/"$linux_user"/ebesucher/
|
||||
erfolg "Ordner für ebesucher konnte erstellt werden"
|
||||
else
|
||||
fehler "Der Ordner für ebesucher konnte nicht angelegt werden"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
ebesucher_docker() {
|
||||
if docker rm -f ebesucher || true && docker run -d --name=ebesucher -p 3000:5800 -m "$1" -v ~/ebesucher/config:/config:rw --shm-size 2g jlesage/firefox; then
|
||||
@@ -235,22 +228,22 @@ Gebe in das Feld deinen Ebesucher Nutzernamen ein und mache einen Haken bei Priv
|
||||
erstelle ich eine Sicherung der Firefox-Konfiguration"
|
||||
{
|
||||
echo 10
|
||||
if [ -f ~/ebesucher/config.zip ]; then
|
||||
rm -f ~/ebesucher/config.zip
|
||||
if [ -f /root/ebesucher/config.zip ]; then
|
||||
rm -f /root/ebesucher/config.zip
|
||||
fi
|
||||
echo 15
|
||||
docker stop ebesucher
|
||||
echo 25
|
||||
cd ~/ebesucher/ || exit
|
||||
cd /root/ebesucher/ || exit
|
||||
echo 30
|
||||
zip -r config.zip config/
|
||||
echo 60
|
||||
wget -O ~/ebesucher/restart.sh https://raw.githubusercontent.com/Pakobbix/passive-income/master/restart.sh
|
||||
wget -O /root/ebesucher/restart.sh https://raw.githubusercontent.com/Pakobbix/passive-income/master/restart.sh
|
||||
echo 80
|
||||
chmod +x ~/ebesucher/restart.sh
|
||||
bash ~/ebesucher/restart.sh
|
||||
chmod +x /root/ebesucher/restart.sh
|
||||
bash /root/ebesucher/restart.sh
|
||||
echo 90
|
||||
sed -i "s/username=/&$nutzername/g" ~/ebesucher/restart.sh
|
||||
sed -i "s/username=/&$nutzername/g" /root/ebesucher/restart.sh
|
||||
echo 100
|
||||
} | whiptail --gauge "Erstelle Sicherung und Lade Restarter Skript herunter" 6 50 0
|
||||
|
||||
@@ -263,47 +256,23 @@ Dies wird gemacht, damit sich nicht zuviel Müll ansammelt und um zu gewährleis
|
||||
dass es für immer läuft.
|
||||
Selbst wenn der Container mal abstürzen sollte, wird er nächste Stunde wieder neugestartet."
|
||||
crontab -l >/tmp/ebesucher 2>/dev/null
|
||||
if [ "$linux_user" == "root" ]; then
|
||||
if ! grep -q "ebesucher/restart.sh" "/tmp/ebesucher"; then
|
||||
echo "0 * * * * /bin/bash /root/ebesucher/restart.sh
|
||||
@reboot /bin/bash /root/ebesucher/restart.sh" >>/tmp/ebesucher
|
||||
fi
|
||||
else
|
||||
if ! grep -q "ebesucher/restart.sh" "/tmp/ebesucher"; then
|
||||
echo "0 * * * * /bin/bash /home/$linux_user/ebesucher/restart.sh
|
||||
@reboot /bin/bash /home/$linux_user/ebesucher/restart.sh" >>/tmp/ebesucher
|
||||
crontab /tmp/ebesucher
|
||||
rm /tmp/ebesucher
|
||||
fi
|
||||
crontab -l >/tmp/rootcron
|
||||
echo "0 0 * * 0 reboot" >>/tmp/rootcron
|
||||
sudo crontab /tmp/rootcron
|
||||
rm /tmp/rootcron
|
||||
@reboot /bin/bash /root/ebesucher/restart.sh
|
||||
0 0 * * 0 reboot" >>/tmp/ebesucher
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
|
||||
if [ "$linux_user" == "root" ]; then
|
||||
echo -e "#!/bin/bash\n\nexport DEBIAN_FRONTEND=noninteractive\n\nsudo apt-get update\n\nsudo apt-get upgrade -y\n\nsudo apt-get autoremove -y" >/root/update_system.sh
|
||||
chmod +x /root/update_system.sh
|
||||
else
|
||||
echo -e "#!/bin/bash\n\nexport DEBIAN_FRONTEND=noninteractive\n\nsudo apt-get update\n\nsudo apt-get upgrade -y\n\nsudo apt-get autoremove -y" >/home/"$linux_user"/update_system.sh
|
||||
chmod +x /home/"$linux_user"/update_system.sh
|
||||
fi
|
||||
echo -e "#!/bin/bash\n\nexport DEBIAN_FRONTEND=noninteractive\n\nsudo apt-get update\n\nsudo apt-get upgrade -y\n\nsudo apt-get autoremove -y" >/root/update_system.sh
|
||||
chmod +x /root/update_system.sh
|
||||
if ! grep -q "update_system.sh" "/tmp/updatecron"; then
|
||||
if [ "$linux_user" == "root" ]; then
|
||||
crontab -l /tmp/updatecron
|
||||
echo "0 4 * * * /bin/bash /root/update_system.sh" >>/tmp/updatecron
|
||||
crontab /tmp/updatecron
|
||||
rm /tmp/crontab
|
||||
else
|
||||
sudo crontab -l /tmp/updatecron
|
||||
echo "0 4 * * * /bin/bash /home/$linux_user/update_system.sh" >>/tmp/updatecron
|
||||
sudo crontab /tmp/updatecron
|
||||
rm /tmp/updatecron
|
||||
fi
|
||||
fi
|
||||
if docker ps | grep "ebesucher\|traffmonetizer\|peer2profit\|IPRoyal\|packetstream\|honeygain" >/dev/null; then
|
||||
if docker run -d --name watchtower --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v /etc/localtime:/etc/localtime:ro containrrr/watchtower --cleanup --interval 86400; then
|
||||
|
||||
332
notifier.sh
Normal file
332
notifier.sh
Normal file
@@ -0,0 +1,332 @@
|
||||
#!/bin/bash
|
||||
|
||||
red='\033[0;31m' # ${red}
|
||||
white='\033[0;37m' # ${white}
|
||||
yellow='\033[0;33m' # ${yellow}
|
||||
lblue='\033[1;34m' # ${lblue}
|
||||
cyan='\033[0;36m' # ${cyan}
|
||||
purple='\033[0;35m' # ${purple}
|
||||
|
||||
Help() {
|
||||
# Display Help
|
||||
echo
|
||||
echo -e "${purple}Benachrichtigungs Skript für Passive-Income (pain).${white}"
|
||||
echo
|
||||
echo "Ausführung: ./notifier.sh"
|
||||
echo
|
||||
echo "Für erneute Configuration: ./notifier.sh -c"
|
||||
echo
|
||||
echo "Argumente:"
|
||||
echo -e "${yellow} -c${white} ${lblue}Starte die Konfiguration erneut"
|
||||
echo -e "${yellow} -h${white} ${lblue}Zeige diese Hilfe"
|
||||
echo
|
||||
}
|
||||
|
||||
fehler() {
|
||||
echo -e "${red}$1${white}"
|
||||
}
|
||||
|
||||
Hinweis() {
|
||||
echo -e "${yellow}$1${white}"
|
||||
|
||||
}
|
||||
|
||||
URLlink() {
|
||||
echo -e "${cyan}$1${white}"
|
||||
}
|
||||
|
||||
config="/opt/Passive-Income/NotificationHandler/config"
|
||||
|
||||
setup_config() {
|
||||
while true; do
|
||||
messagehandler=$(
|
||||
whiptail --title "Wähle den Notifier" --menu "Nehme hier die Art der Benachrichtung die du haben willst." 20 100 9 \
|
||||
"SurfbarName" "" \
|
||||
"Discord" "" \
|
||||
"Telegram" "" \
|
||||
"Apprise" "" \
|
||||
"NextcloudTalk" "" \
|
||||
"PushBullet" "" \
|
||||
"Email" "" \
|
||||
"Rocket.Chat" "" \
|
||||
"CronErstellen" "" \
|
||||
"Beenden" "" 3>&2 2>&1 1>&3
|
||||
)
|
||||
case "$messagehandler" in
|
||||
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\nEs können auch mehrere eingegeben werden." 16 100 3>&2 2>&1 1>&3)
|
||||
if [ -n "$surflink" ]; then
|
||||
sed -i "s/SurfbarName=.*/SurfbarName=\"$surflink\"/g" $config
|
||||
fi
|
||||
;;
|
||||
Discord)
|
||||
dishook=$(whiptail --title "Discord Webhook URL" --inputbox "Gebe hier deine Discord Webhook URL ein" 16 100 3>&2 2>&1 1>&3)
|
||||
if [ -n "$dishook" ]; then
|
||||
sed -i "s|Discord_WebHookLink=.*|Discord_WebHookLink=\"$dishook\"|g" $config
|
||||
sed -i "s/NotificationHandler=.*/NotificationHandler=\"Discord\"/g" $config
|
||||
fi
|
||||
;;
|
||||
Telegram)
|
||||
T_UI=$(whiptail --title "Telegram USER ID" --inputbox "Gebe hier deine Telegram USERID ein" 16 100 3>&2 2>&1 1>&3)
|
||||
T_BotToken=$(whiptail --title "Telegram Bot Token" --inputbox "Gebe hier deinen Telegram Bot Token ein" 16 100 3>&2 2>&1 1>&3)
|
||||
if [ -n "$T_UI" ]; then
|
||||
sed -i "s/Telegram_UID=.*/Telegram_UID=\"$T_UI\"/g" $config
|
||||
sed -i "s/NotificationHandler=.*/NotificationHandler=\"Telegram\"/g" $config
|
||||
fi
|
||||
if [ -n "$T_BotToken" ]; then
|
||||
sed -i "s/Telegram_BT=.*/Telegram_BT=\"$T_BotToken\"/g" $config
|
||||
fi
|
||||
;;
|
||||
Apprise)
|
||||
AppRise_URL=$(whiptail --title "AppRise URL" --inputbox "Gebe hier die AppRise URL ein\nNötig ist hier die IP:Port. Beispiel:\n192.168.5.21:8000" 16 100 3>&2 2>&1 1>&3)
|
||||
AppRise_URL_TAG=$(whiptail --title "AppRise Tag" --inputbox "Gebe hier einen AppRise Tag ein (Optional! Achtung, ohne Tag\nwerden alle Konfigurierten Methoden in Apprise genutzt)" 16 100 3>&2 2>&1 1>&3)
|
||||
if [ -n "$AppRise_URL" ]; then
|
||||
sed -i "s|AppRiseURL=.*|AppRiseURL=\"$AppRise_URL/notify/apprise\"|g" $config
|
||||
sed -i "s/NotificationHandler=.*/NotificationHandler=\"Apprise\"/g" $config
|
||||
fi
|
||||
if [ -n "$AppRise_URL_TAG" ]; then
|
||||
sed -i "s/AppRiseTAG=.*/AppRiseTAG=\"$AppRise_URL_TAG\"/g" $config
|
||||
fi
|
||||
;;
|
||||
NextcloudTalk)
|
||||
NextcloudDomain=$(whiptail --title "Nextcloud Domain" --inputbox "Gebe hier deine Nextcloud Domain/IP:Port ein\nBeispiel: 10.0.0.4:85 oder\nhttps://cloud.zephyre.one" 16 100 3>&2 2>&1 1>&3)
|
||||
NextcloudTalkToken=$(whiptail --title "Nextcloud Talk Token" --inputbox "Gebe hier deinen Nextcloud Talk Chatroom Token ein\nhttps://cloud.zephyre.one/call/9gp9y99i\n9gp9y99i ist der benötigte Token" 16 100 3>&2 2>&1 1>&3)
|
||||
NextcloudUser=$(whiptail --title "Nextcloud User" --inputbox "Gebe hier deinen Nextcloud User ein der die Nachricht schreiben soll.\nDer User muss dem Chatroom hinzugefügt werden!" 16 100 3>&2 2>&1 1>&3)
|
||||
NextcloudPassword=$(whiptail --title "Nextcloud Password" --passwordbox "Gebe hier das Passwort von dem Nextcloud User ein" 16 100 3>&2 2>&1 1>&3)
|
||||
if [ -n "$NextcloudDomain" ]; then
|
||||
sed -i "s|NextcloudDomain=.*|NextcloudDomain=\"$NextcloudDomain\"|g" $config
|
||||
sed -i "s/NotificationHandler=.*/NotificationHandler=\"NextCloud\"/g" $config
|
||||
fi
|
||||
if [ -n "$NextcloudTalkToken" ]; then
|
||||
sed -i "s/NextcloudTalkToken=.*/NextcloudTalkToken=\"$NextcloudTalkToken\"/g" $config
|
||||
fi
|
||||
if [ -n "$NextcloudUser" ]; then
|
||||
sed -i "s/NextcloudUser=.*/NextcloudUser=\"$NextcloudUser\"/g" $config
|
||||
fi
|
||||
if [ -n "$NextcloudPassword" ]; then
|
||||
sed -i "s/NextcloudPassword=.*/NextcloudPassword=\"$NextcloudPassword\"/g" $config
|
||||
fi
|
||||
;;
|
||||
PushBullet)
|
||||
PBToken=$(whiptail --title "Pushbullet Token" --inputbox "Gebe hier deinen Pushbullet Token ein" 16 100 3>&2 2>&1 1>&3)
|
||||
if [ -n "$PBToken" ]; then
|
||||
sed -i "s/PushBulletToken=.*/PushBulletToken=\"$PBToken\"/g" $config
|
||||
sed -i "s/NotificationHandler=.*/NotificationHandler=\"PushBullet\"/g" $config
|
||||
fi
|
||||
;;
|
||||
Email)
|
||||
smtpURL=$(whiptail --title "Nextcloud Domain" --inputbox "Gebe hier die SMTP Domain ein" 16 100 3>&2 2>&1 1>&3)
|
||||
smtpPORT=$(whiptail --title "Nextcloud Talk Token" --inputbox "Gebe hier den SMTP Port an" 16 100 3>&2 2>&1 1>&3)
|
||||
mailfrom=$(whiptail --title "Nextcloud User" --inputbox "Gebe hier die E-Mail an, die die Nachricht verschicken soll" 16 100 3>&2 2>&1 1>&3)
|
||||
mailrcpt=$(whiptail --title "Nextcloud Password" --inputbox "Gebe hier die E-Mail an, die die Nachricht erhalten soll" 16 100 3>&2 2>&1 1>&3)
|
||||
mailuser=$(whiptail --title "Nextcloud User" --inputbox "Gebe hier den User für die E-Mail an" 16 100 3>&2 2>&1 1>&3)
|
||||
mailpass=$(whiptail --title "Nextcloud Password" --passwordbox "Gebe das Passwort des Users ein" 16 100 3>&2 2>&1 1>&3)
|
||||
if [ -n "$smtpURL" ]; then
|
||||
sed -i "s/smtpURL=.*/smtpURL=\"$smtpURL\"/g" $config
|
||||
sed -i "s/NotificationHandler=.*/NotificationHandler=\"Email\"/g" $config
|
||||
fi
|
||||
if [ -n "$smtpPORT" ]; then
|
||||
sed -i "s/smtpPORT=.*/smtpPORT=\"$smtpPORT\"/g" $config
|
||||
fi
|
||||
if [ -n "$mailfrom" ]; then
|
||||
sed -i "s/mailfrom=.*/mailfrom=\"$mailfrom\"/g" $config
|
||||
fi
|
||||
if [ -n "$mailrcpt" ]; then
|
||||
sed -i "s/mailrcpt=.*/mailrcpt=\"$mailrcpt\"/g" $config
|
||||
fi
|
||||
if [ -n "$mailuser" ]; then
|
||||
sed -i "s/mailuser=.*/mailuser=\"$mailuser\"/g" $config
|
||||
fi
|
||||
if [ -n "$mailpass" ]; then
|
||||
sed -i "s/mailpass=.*/mailpass=\"$mailpass\"/g" $config
|
||||
fi
|
||||
;;
|
||||
Rocket.Chat)
|
||||
RCHOOK=$(whiptail --title "Rocket Chat Webhook" --inputbox "Gebe hier deine Rocket.Chat Webhook ein" 16 100 3>&2 2>&1 1>&3)
|
||||
if [ -n "$RCHOOK" ]; then
|
||||
sed -i "s/RocketChatHook=.*/RocketChatHook=\"$RCHOOK\"/g" $config
|
||||
sed -i "s/NotificationHandler=.*/NotificationHandler=\"Rocket.Chat\"/g" $config
|
||||
fi
|
||||
;;
|
||||
CronErstellen)
|
||||
cronloc="/tmp/crontab"
|
||||
curr_dir=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
|
||||
scriptname=$(echo "$0" | sed 's/\.\///g')
|
||||
crontab -l "$cronloc"
|
||||
if grep -q "notifier.sh" $cronloc; then
|
||||
if whiptail --title "Eintrag bereits vorhanden" --yesno "Es ist bereits ein eintrag für den notifier vorhanden, möchtest du diesen überschreiben?" 20 100; then
|
||||
sed -i "s|.*notifier.sh.*|10,20,30,40,50 * * * * /bin/bash $curr_dir/$scriptname|g" "$cronloc"
|
||||
crontab "$cronloc"
|
||||
fi
|
||||
else
|
||||
echo "10,20,30,40,50 * * * * /bin/bash $curr_dir/$scriptname|g" >>"$cronloc"
|
||||
crontab "$cronloc"
|
||||
fi
|
||||
;;
|
||||
Beenden)
|
||||
break
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
break
|
||||
exit
|
||||
done
|
||||
}
|
||||
|
||||
while getopts ":hc" option; do
|
||||
case $option in
|
||||
h) # display Help
|
||||
Help
|
||||
exit
|
||||
;;
|
||||
c) # Starte eine erneute Konfiguration
|
||||
if ! [ -f "$config" ]; then
|
||||
mkdir -p /opt/Passive-Income/NotificationHandler 2>/dev/null
|
||||
wget -qO "$config" https://raw.githubusercontent.com/Pakobbix/passive-income/NotificationHandler/NotificationHandler/config
|
||||
fi
|
||||
setup_config
|
||||
exit
|
||||
;;
|
||||
\?) # Invalid option
|
||||
echo "Fehler: Ungültige Eingabe"
|
||||
Help
|
||||
exit
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if ! [ -d "/opt/Passive-Income/NotificationHandler" ] || ! [ -f "$config" ]; then
|
||||
mkdir -p /opt/Passive-Income/NotificationHandler 2>/dev/null
|
||||
wget -qO "$config" https://raw.githubusercontent.com/Pakobbix/passive-income/NotificationHandler/NotificationHandler/config
|
||||
setup_config
|
||||
fi
|
||||
|
||||
source "$config"
|
||||
|
||||
if [ -z "$NotificationHandler" ]; then
|
||||
setup_config
|
||||
fi
|
||||
|
||||
if [ -z "$SurfbarName" ]; then
|
||||
fehler "SurfbarName ist nicht gesetzt!"
|
||||
Hinweis "Wenn du weiter drückst, wird die Konfiguration nochmal aufgerufen. Wähle hier dann SurfbarName um diesen zu Konfigurieren"
|
||||
read -rp "Drücke eine beliebige Taste zum fortfahren"
|
||||
setup_config
|
||||
fi
|
||||
|
||||
for SurfbarLinks in $SurfbarName; do
|
||||
|
||||
ProcessID=$(pgrep -f "surfbar/$SurfbarLinks")
|
||||
|
||||
case $NotificationHandler in
|
||||
Discord)
|
||||
if [ -z "$Discord_WebHookLink" ]; then
|
||||
fehler "Fehler! Discord wurde ausgewählt, aber keine WebHook angegeben!"
|
||||
echo
|
||||
Hinweis "Eine Anleitung für die Webhook findet ihr hier:"
|
||||
URLlink "https://hookdeck.com/webhooks/platforms/how-to-get-started-with-discord-webhooks#how-do-i-add-a-webhook-to-discord"
|
||||
exit 1
|
||||
else
|
||||
if [ -z "$ProcessID" ]; then
|
||||
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
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
Telegram)
|
||||
if [ -z "$Telegram_UID" ] || [ -z "$Telegram_BT" ]; then
|
||||
fehler "Fehler! Discord wurde ausgewählt, aber keine WebHook angegeben!"
|
||||
echo
|
||||
Hinweis "Eine Anleitung für die Webhook findet ihr hier:"
|
||||
URLlink "https://hookdeck.com/webhooks/platforms/how-to-get-started-with-discord-webhooks#how-do-i-add-a-webhook-to-discord"
|
||||
exit 1
|
||||
else
|
||||
if [ -z "$ProcessID" ]; then
|
||||
curl -X POST -H 'Content-Type: application/json' -d '{"chat_id": "'"$Telegram_UID"'", "text": "'"Ebesucher auf $surflink"'", "disable_notification": true}' https://api.telegram.org/bot$Telegram_BT/sendMessage
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
Apprise)
|
||||
if [ -z "$AppRiseURL" ]; then
|
||||
fehler "Fehler! AppRise wurde ausgewählt, aber keine URL angegeben!"
|
||||
echo
|
||||
Hinweis "Eine Anleitung für AppRise findet ihr hier"
|
||||
URLlink "https://github.com/caronc/apprise/wiki/config"
|
||||
exit 1
|
||||
else
|
||||
if [ -z "$ProcessID" ]; then
|
||||
if [ -n "$AppRiseTAG" ]; then
|
||||
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
|
||||
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
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
NextCloud)
|
||||
if [ -z "$NextcloudUser" ] || [ -z "$NextcloudPassword" ] || [ -z "$NextcloudDomain" ] || [ -z "$NextcloudTalkToken" ]; then
|
||||
echo "Eine oder mehrere Variablen (NextcloudUser, NextcloudPassword, NextcloudDomain, und/oder NextcloudTalkToken) wurden nicht angegeben. Beende NotificationHandler!."
|
||||
exit 1
|
||||
else
|
||||
if [ -z "$ProcessID" ]; then
|
||||
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
|
||||
;;
|
||||
PushBullet)
|
||||
if [ -z "$PushBulletToken" ]; then
|
||||
fehler "Fehler! PushBullet wurde ausgewählt, aber kein Token angegeben!"
|
||||
echo
|
||||
Hinweis "Eine Anleitung für PushBullet findet ihr hier"
|
||||
URLlink "https://www.pushbullet.com/"
|
||||
exit 1
|
||||
else
|
||||
if [ -z "$ProcessID" ]; then
|
||||
curl -X POST -H 'Content-Type: application/json' -d '{"chat_id": "'"$Telegram_UID"'", "text": "'"Ebesucher auf $surflink"'", "disable_notification": true}' https://api.telegram.org/bot$Telegram_BT/sendMessage
|
||||
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
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
Email)
|
||||
if [ -z "$smtpURL" ] || [ -z "$smtpPORT" ] || [ -z "$mailfrom" ] || [ -z "$mailrcpt" ] || [ -z "$mailuser" ] || [ -z "$mailpass" ]; then
|
||||
echo "Fehler! Mail wurde ausgewählt, aber eines oder mehrere Variablen leer gelassen!"
|
||||
exit 1
|
||||
else
|
||||
if [ -z "$ProcessID" ]; then
|
||||
echo "From: Passive-Income $mailfrom
|
||||
To: $mailrcpt $mailrcpt
|
||||
Subject: Passive-Income Notification: Ebesucher ist Abgestürzt
|
||||
|
||||
Hi $mailrcpt,
|
||||
Your Ebesucher Container $SurfbarLinks ist abgestürzt und läuft nicht mehr.
|
||||
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
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
Rocket.Chat)
|
||||
if [ -z "$RocketChatHook" ]; then
|
||||
fehler "Fehler! RocketChat wurde ausgewählt, aber keine WebHook angegeben!"
|
||||
echo
|
||||
Hinweis "Eine Anleitung für die Webhook findet ihr hier:"
|
||||
URLlink "https://docs.rocket.chat/use-rocket.chat/rocket.chat-workspace-administration/integrations"
|
||||
exit 1
|
||||
else
|
||||
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 '"$SurfbarLinks"' ist down","color":"#764FA5"}]}' "$RocketChatHook"
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
done
|
||||
Reference in New Issue
Block a user