mirror of
https://github.com/Pakobbix/passive-income.git
synced 2025-11-09 14:59:40 +00:00
Menu Loop added. add Crontab entry via config.
This commit is contained in:
parent
d31d7e9f60
commit
d23d1752ca
24
notifier.sh
24
notifier.sh
@ -40,6 +40,7 @@ URLlink() {
|
|||||||
config="/opt/Passive-Income/NotificationHandler/config"
|
config="/opt/Passive-Income/NotificationHandler/config"
|
||||||
|
|
||||||
setup_config() {
|
setup_config() {
|
||||||
|
while true; do
|
||||||
messagehandler=$(
|
messagehandler=$(
|
||||||
whiptail --title "Wähle den Notifier" --menu "Nehme hier die Art der Benachrichtung die du haben willst." 20 100 9 \
|
whiptail --title "Wähle den Notifier" --menu "Nehme hier die Art der Benachrichtung die du haben willst." 20 100 9 \
|
||||||
"SurfbarName" "" \
|
"SurfbarName" "" \
|
||||||
@ -50,9 +51,25 @@ setup_config() {
|
|||||||
"PushBullet" "" \
|
"PushBullet" "" \
|
||||||
"Email" "" \
|
"Email" "" \
|
||||||
"Rocket.Chat" "" \
|
"Rocket.Chat" "" \
|
||||||
"Abbrechen" "" 3>&2 2>&1 1>&3
|
"CronErstellen" \
|
||||||
|
"Beenden" "" 3>&2 2>&1 1>&3
|
||||||
)
|
)
|
||||||
case "$messagehandler" in
|
case "$messagehandler" in
|
||||||
|
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
|
||||||
|
;;
|
||||||
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\nEs können auch mehrere eingegeben werden." 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
|
||||||
@ -148,11 +165,14 @@ setup_config() {
|
|||||||
sed -i "s/NotificationHandler=.*/NotificationHandler=\"Rocket.Chat\"/g" $config
|
sed -i "s/NotificationHandler=.*/NotificationHandler=\"Rocket.Chat\"/g" $config
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
Abbrechen)
|
Beenden)
|
||||||
|
break
|
||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
break
|
||||||
exit
|
exit
|
||||||
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
while getopts ":hc" option; do
|
while getopts ":hc" option; do
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user